From 95ec6ddb2367cb586705dbcd0fedc3d1ac6582bb Mon Sep 17 00:00:00 2001 From: Kent Boogaart Date: Sat, 18 Apr 2020 01:50:28 +1000 Subject: [PATCH 1/9] More simple fixes to tuple signatures (#17904) --- .../asynchronous-and-concurrent-programming/async.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/fsharp/tutorials/asynchronous-and-concurrent-programming/async.md b/docs/fsharp/tutorials/asynchronous-and-concurrent-programming/async.md index 5d22c2b7ddb07..d9e054c61755f 100644 --- a/docs/fsharp/tutorials/asynchronous-and-concurrent-programming/async.md +++ b/docs/fsharp/tutorials/asynchronous-and-concurrent-programming/async.md @@ -161,7 +161,7 @@ Runs an asynchronous computation, starting immediately on the current operating Signature: ```fsharp -computation: Async - cancellationToken: ?CancellationToken -> unit +computation: Async * cancellationToken: ?CancellationToken -> unit ``` When to use: @@ -179,7 +179,7 @@ Executes a computation in the thread pool. Returns a - taskCreationOptions: ?TaskCreationOptions - cancellationToken: ?CancellationToken -> Task<'T> +computation: Async<'T> * taskCreationOptions: ?TaskCreationOptions * cancellationToken: ?CancellationToken -> Task<'T> ``` When to use: @@ -197,7 +197,7 @@ Schedules a sequence of asynchronous computations to be executed in parallel. Th Signature: ```fsharp -computations: seq> - ?maxDegreesOfParallelism: int -> Async<'T[]> +computations: seq> * ?maxDegreesOfParallelism: int -> Async<'T[]> ``` When to use it: @@ -236,7 +236,7 @@ Returns an asynchronous computation that waits for the given -> Async<'T> +task: Task<'T> -> Async<'T> ``` When to use: @@ -290,7 +290,7 @@ Runs an asynchronous computation and awaits its result on the calling thread. Th Signature: ```fsharp -computation: Async<'T> - timeout: ?int - cancellationToken: ?CancellationToken -> 'T +computation: Async<'T> * timeout: ?int * cancellationToken: ?CancellationToken -> 'T ``` When to use it: @@ -309,7 +309,7 @@ Starts an asynchronous computation in the thread pool that returns `unit`. Doesn Signature: ```fsharp -computation: Async - cancellationToken: ?CancellationToken -> unit +computation: Async * cancellationToken: ?CancellationToken -> unit ``` Use only when: From 4cad52f61399ca3adfda81fbce141e07e666d131 Mon Sep 17 00:00:00 2001 From: Petr Kulikov Date: Fri, 17 Apr 2020 17:59:34 +0200 Subject: [PATCH 2/9] Clarify thread-safe event raising (#17888) * Clarify thread-safe event raising * Update docs/csharp/language-reference/operators/member-access-operators.md Co-Authored-By: Bill Wagner * Minor update Co-authored-by: Bill Wagner --- .../language-reference/operators/member-access-operators.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/csharp/language-reference/operators/member-access-operators.md b/docs/csharp/language-reference/operators/member-access-operators.md index 13d333bfedddb..b177ef03bfdfe 100644 --- a/docs/csharp/language-reference/operators/member-access-operators.md +++ b/docs/csharp/language-reference/operators/member-access-operators.md @@ -1,7 +1,7 @@ --- title: "Member access operators and expressions - C# reference" description: "Learn about C# operators that you can use to access type members." -ms.date: 03/31/2020 +ms.date: 04/17/2020 author: pkulikov f1_keywords: - "._CSharpKeyword" @@ -150,6 +150,8 @@ if (handler != null) } ``` +That is a thread-safe way to ensure that only a non-null `handler` is invoked. Because delegate instances are immutable, no thread can change the value referenced by the `handler` local variable. In particular, if the code executed by another thread unsubscribes from the `PropertyChanged` event and `PropertyChanged` becomes `null` before `handler` is invoked, the value referenced by `handler` remains unaffected. The `?.` operator evaluates its left-hand operand no more than once, guaranteeing that it cannot be changed to `null` after being verified as non-null. + ## Invocation expression () Use parentheses, `()`, to call a [method](../../programming-guide/classes-and-structs/methods.md) or invoke a [delegate](../../programming-guide/delegates/index.md). From 63ee2a4c795b71344f315cfa52c310ad33d65d1f Mon Sep 17 00:00:00 2001 From: Next Turn <45985406+NextTurn@users.noreply.github.com> Date: Sat, 18 Apr 2020 00:02:06 +0800 Subject: [PATCH 3/9] Normalizes trailing spaces in samples, Part 1 (#17895) --- .../snippets/NullableValueTypes.cs | 2 +- .../builtin-types/snippets/VoidType.cs | 2 +- .../operators/snippets/AdditionOperator.cs | 2 +- .../operators/snippets/ArithmeticOperators.cs | 12 +- .../operators/snippets/AssignmentOperator.cs | 2 +- .../operators/snippets/AwaitOperator.cs | 4 +- .../snippets/BitwiseAndShiftOperators.cs | 2 +- .../snippets/BooleanLogicalOperators.cs | 12 +- .../operators/snippets/ConditionalOperator.cs | 2 +- .../operators/snippets/DelegateOperator.cs | 2 +- .../snippets/MemberAccessOperators.cs | 2 +- .../snippets/NullCoalescingOperator.cs | 2 +- .../operators/snippets/PointerOperators.cs | 2 +- .../operators/snippets/SubtractionOperator.cs | 2 +- .../operators/snippets/SwitchExpressions.cs | 6 +- .../TypeTestingAndConversionOperators.cs | 2 +- .../snippets/UserDefinedConversions.cs | 2 +- .../concepts/async/snippets/AsyncStreams.cs | 4 +- .../concepts/async/snippets/async-returns1.cs | 4 +- .../async/snippets/async-returns1a.cs | 4 +- .../concepts/async/snippets/async-returns2.cs | 6 +- .../async/snippets/async-returns2a.cs | 6 +- .../async/snippets/async-valuetask.cs | 14 +- .../MetadataLoadContextSnippets.cs | 4 +- .../DateTimeOffsetNullHandlingConverter.cs | 10 +- .../csharp/DeserializeCaseInsensitive.cs | 2 +- .../csharp/DeserializeIgnoreNull.cs | 2 +- .../DictionaryTKeyEnumTValueConverter.cs | 12 +- .../SerializeCamelCaseDictionaryKeys.cs | 2 +- .../system-text-json/csharp/Temperature.cs | 2 +- .../WeatherForecastRuntimeIgnoreConverter.cs | 4 +- .../whats-new-in-21/csharp/brotli.cs | 2 +- .../core/whats-new/whats-new-in-30/cs/JSON.cs | 2 +- .../whats-new/whats-new-in-30/cs/Program.cs | 4 +- .../core/whats-new/whats-new-in-30/cs/TLS.cs | 2 +- .../customdataserviceclient/program.cs | 4 +- .../CPP/ChannelServices_GetChannel_Share.cs | 4 +- ...annelServices_SyncDispatchMessage_share.cs | 6 +- .../CPP/IChannelSender_Share.cs | 6 +- .../cpp/window1.xaml.cs | 60 +- .../PatternMatching/GeometricUtilities.cs | 2 +- .../csharp/PatternMatching/Program.cs | 6 +- .../CS/source.cs | 16 +- .../CS/Program.cs | 52 +- .../DP DataView Samples/CS/Form1.Designer.cs | 152 ++--- .../DP DataView Samples/CS/Form1.cs | 40 +- .../CS/Form1.Designer.cs | 8 +- .../DP DataViewWinForms Sample/CS/Form1.cs | 2 +- .../DP LINQ to DataSet Examples/CS/Program.cs | 38 +- .../DataWorks BulkCopy.Single/CS/source.cs | 14 +- .../CS/source.cs | 2 +- .../CS/source.cs | 2 +- .../CS/source.cs | 2 +- .../DataWorks Data.DataTableAdd/CS/source.cs | 2 +- .../DataWorks DataSet.Merge/CS/source.cs | 6 +- .../CS/source.cs | 6 +- .../CS/source.cs | 2 +- .../DataWorks DataTable.Events/CS/source.cs | 2 +- .../CS/source.cs | 8 +- .../CS/source.cs | 10 +- .../CS/source.cs | 6 +- .../CS/source.cs | 2 +- .../CS/source.cs | 2 +- .../CS/source.cs | 4 +- .../CS/source.cs | 6 +- .../CS/source.cs | 8 +- .../DataWorks SampleApp.Odbc/CS/source.cs | 6 +- .../DataWorks SampleApp.OleDb/CS/source.cs | 4 +- .../DataWorks SampleApp.Oracle/CS/source.cs | 2 +- .../CS/source.cs | 2 +- .../CS/source.cs | 16 +- .../CS/source.cs | 12 +- .../CS/source.cs | 6 +- .../CS/source.cs | 24 +- .../CS/source.cs | 32 +- .../CS/source.cs | 32 +- .../CS/source.cs | 32 +- .../DataWorks SqlClient.CAS/CS/source.cs | 24 +- .../CS/source.cs | 2 +- .../CS/source.cs | 2 +- .../CS/source.cs | 18 +- .../DataWorks SqlClient.HasRows/CS/source.cs | 2 +- .../CS/source.cs | 8 +- .../CS/source.cs | 2 +- .../CS/source.cs | 8 +- .../CS/source.cs | 2 +- .../CS/source.cs | 2 +- .../CS/source.cs | 2 +- .../CS/source.cs | 8 +- .../CS/source.cs | 6 +- .../CS/source.cs | 2 +- .../DataWorks SqlTypes.GetTypeAW/CS/source.cs | 6 +- .../DataWorks SqlTypes.Guid/CS/source.cs | 2 +- .../DataWorks SqlTypes.IsNull/CS/source.cs | 2 +- .../CFX_ActivityExample/cs/Program.cs | 6 +- .../CFX_CompensationExample/cs/Program.cs | 8 +- .../cs/Program.cs | 6 +- .../cs/auditingsecurityevents.cs | 14 +- .../cs/source.cs | 10 +- .../cs/program.cs | 16 +- .../c_configureportsharing/cs/source.cs | 4 +- .../c_createsecuresession/cs/secureservice.cs | 4 +- .../c_createstatefulsct/cs/secureservice.cs | 6 +- .../VS_Snippets_CFX/c_creatests/cs/source.cs | 4 +- .../c_customauthmgr/cs/c_customauthmgr.cs | 10 +- .../c_customauthpol/cs/c_customauthpol.cs | 2 +- .../c_custombinding/cs/c_custombinding.cs | 14 +- .../c_custombindingsauthmode/cs/source.cs | 14 +- .../c_customcertificatevalidator/cs/source.cs | 6 +- .../c_customclaim/cs/c_customclaim.cs | 2 +- .../cs/c_customclaimcomparison.cs | 6 +- .../c_customcredentials/cs/source.cs | 36 +- .../cs/c_customfederationbinding.cs | 8 +- .../c_customtoken/cs/source.cs | 80 +-- .../c_customtokenauthenticator/cs/source.cs | 12 +- .../c_customtokenprovider/cs/source.cs | 2 +- .../cs/service.cs | 4 +- .../c_datacontract/cs/source.cs | 14 +- .../c_datacontractnames/cs/source.cs | 22 +- .../c_datacontractversioning/cs/source.cs | 2 +- .../c_debuggingwindowsauth/cs/source.cs | 12 +- .../c_duplexservices/cs/generatedclient.cs | 54 +- .../c_federatedclient/cs/source.cs | 2 +- .../c_federatedservice/cs/source.cs | 10 +- .../VS_Snippets_CFX/c_federation/cs/source.cs | 24 +- .../c_federationbinding/cs/source.cs | 26 +- .../c_findclaimsperf/cs/c_findclaimsperf.cs | 2 +- .../VS_Snippets_CFX/c_fourcerts/cs/source.cs | 32 +- .../cs/duplexproxycode.cs | 32 +- .../c_generatedcodefiles/cs/proxycode.cs | 2 +- .../c_how_to_cf_async/cs/generatedclient.cs | 74 +-- .../cs/program.cs | 6 +- .../c_howto_codeclientbinding/cs/client.cs | 32 +- .../cs/generatedclient.cs | 40 +- .../c_howto_codeservicebinding/cs/source.cs | 6 +- .../cs/client.cs | 2 +- .../cs/generatedclient.cs | 40 +- .../cs/source.cs | 2 +- .../cs/source.cs | 2 +- .../cs/source.cs | 2 +- .../cs/source.cs | 8 +- .../cs/client.cs | 48 +- .../cs/service.cs | 2 +- .../c_howto_enablestreaming/cs/service.cs | 6 +- .../c_howto_hostiniis/cs/source.cs | 2 +- .../c_howto_hostinntservice/cs/service.cs | 8 +- .../c_howto_hostinwas/cs/client.cs | 36 +- .../c_howto_hostinwas/cs/service.cs | 2 +- .../c_howto_usereliablesession/cs/client.cs | 48 +- .../c_howto_usereliablesession/cs/service.cs | 2 +- .../c_howtosecureendpoint/cs/source.cs | 12 +- .../cs/source.cs | 16 +- .../c_howtousechannelfactory/cs/source.cs | 2 +- .../c_idatacontractsurrogate/cs/source.cs | 4 +- .../c_impersonationanddelegation/cs/source.cs | 6 +- .../c_knowntypeattribute/cs/source.cs | 16 +- .../c_maxclockskew/cs/source.cs | 12 +- .../cs/source.cs | 6 +- .../c_programmingsecurity/cs/source.cs | 4 +- .../c_protectionlevel/cs/source.cs | 2 +- .../cs/source.cs | 6 +- .../c_schemaimportexport/cs/source.cs | 16 +- .../c_securewindowsclient/cs/secureclient.cs | 4 +- .../cs/secureservice.cs | 2 +- .../c_securewithcertificate/cs/source.cs | 8 +- .../c_securityscenarios/cs/source.cs | 66 +-- .../c_settingsecuritymode/cs/source.cs | 2 +- .../c_signatureconfirmation/cs/source.cs | 2 +- .../c_simpleimpersonation/cs/source.cs | 4 +- .../c_supportingcredential/cs/source.cs | 14 +- .../c_syncasyncclient/cs/client.cs | 4 +- .../c_syncasyncclient/cs/proxycode.cs | 56 +- .../c_syncasyncclient/cs/services.cs | 4 +- .../VS_Snippets_CFX/c_tcpclient/cs/source.cs | 6 +- .../VS_Snippets_CFX/c_tcpservice/cs/source.cs | 14 +- .../c_unsecuredclient/cs/source.cs | 2 +- .../c_unsecuredservice/cs/source.cs | 4 +- .../c_usingthemessageclass/cs/source.cs | 24 +- .../cs/generatedclient.cs | 42 +- .../c_wcfclienttowseservice/cs/wseclient.cs | 92 +-- .../cs/wsehttpbinding.cs | 8 +- .../c_wshttpservice/cs/source.cs | 8 +- .../c_xmlserializer/cs/source.cs | 12 +- .../callbackbehaviorattribute/cs/client.cs | 2 +- .../callbackbehaviorattribute/cs/proxycode.cs | 26 +- .../cs/program.cs | 2 +- .../cfx_wf_gettingstarted/cs/extrasnippets.cs | 2 +- .../cfx_wf_gettingstarted/cs/readint.cs | 4 +- .../cs/program.cs | 96 ++-- .../cfx_workflowinvokerexample/cs/program.cs | 4 +- .../channelfactorybehaviors/cs/client.cs | 6 +- .../channelfactorybehaviors/cs/proxycode.cs | 34 +- .../cs/serviceprogram.cs | 6 +- .../clientproxycodesample/cs/client.cs | 4 +- .../clientproxycodesample/cs/proxycode.cs | 36 +- .../custompolicysample/cs/client.cs | 2 +- .../custompolicysample/cs/policyexporter.cs | 6 +- .../custompolicysample/cs/policyimporter.cs | 4 +- .../custompolicysample/cs/proxycode.cs | 22 +- .../custompolicysample/cs/services.cs | 4 +- .../datacontractattribute/cs/overview.cs | 10 +- .../datamemberattribute/cs/overview.cs | 14 +- .../eventasync/cs/asyncresult.cs | 2 +- .../eventasync/cs/generatedclient.cs | 180 +++--- .../faultcontractattribute/cs/client.cs | 2 +- .../faultcontractattribute/cs/proxycode.cs | 34 +- .../faultcontractattribute/cs/services.cs | 6 +- .../VS_Snippets_CFX/faults/cs/service.cs | 4 +- .../htbasicservice/cs/service.cs | 4 +- .../VS_Snippets_CFX/htrssbasic/cs/snippets.cs | 2 +- .../VS_Snippets_CFX/htsoapweb/cs/program.cs | 4 +- .../cs/channelinitializer.cs | 4 +- .../iinstancecontextinitializer/cs/client.cs | 6 +- .../cs/proxycode.cs | 34 +- .../cs/servicehostcontext.cs | 2 +- .../VS_Snippets_CFX/interceptors/cs/client.cs | 4 +- .../interceptors/cs/insertingbehaviors.cs | 6 +- .../interceptors/cs/interceptors.cs | 4 +- .../interceptors/cs/proxycode.cs | 34 +- .../lockdownvalidation/cs/hostapplication.cs | 10 +- .../messageheaderattribute/cs/client.cs | 4 +- .../messageheaderattribute/cs/proxycode.cs | 36 +- .../messageheaderattribute/cs/services.cs | 10 +- .../metadataresolver/cs/client.cs | 2 +- .../metadataresolver/cs/proxycode.cs | 22 +- .../cs/client.cs | 2 +- .../cs/proxycode.cs | 22 +- .../operationcontextscope/cs/client.cs | 4 +- .../operationcontextscope/cs/proxycode.cs | 26 +- .../operationcontextscope/cs/services.cs | 8 +- .../principalpermissionmode/cs/source.cs | 12 +- .../s_customauthentication/cs/instance.cs | 6 +- .../s_deadletter/cs/dlservice.cs | 2 +- .../s_deadletter/cs/generatedproxy.cs | 56 +- .../s_deadletter/cs/orderprocessorservice.cs | 60 +- .../s_deadletter/cs/service.cs | 2 +- .../VS_Snippets_CFX/s_dualhttp/cs/program.cs | 16 +- .../s_duplexclients/cs/client.cs | 4 +- .../s_duplexclients/cs/proxycode.cs | 44 +- .../s_imperative/cs/service.cs | 2 +- .../s_imperative/cs/servicesnippets.cs | 6 +- .../s_msmq_session/cs/ordertakerservice.cs | 30 +- .../s_msmq_session/cs/service.cs | 4 +- .../s_msmq_transacted/cs/generatedclient.cs | 66 +-- .../s_msmq_transacted/cs/service.cs | 4 +- .../VS_Snippets_CFX/s_msmqtowcf/cs/client.cs | 2 +- .../VS_Snippets_CFX/s_msmqtowcf/cs/order.cs | 2 +- .../VS_Snippets_CFX/s_msmqtowcf/cs/service.cs | 2 +- .../s_service_session/cs/generatedproxy.cs | 50 +- .../s_ue_msmq_poison/cs/generatedproxy.cs | 60 +- .../s_ue_msmq_poison/cs/pmservice.cs | 4 +- .../s_ue_msmq_poison/cs/service.cs | 2 +- .../s_ue_syndicationboth/cs/service.cs | 8 +- .../s_uehelloworld/cs/helloservice.cs | 22 +- .../s_uehelloworld/cs/snippet.cs | 2 +- .../s_uewsdlexporter/cs/program.cs | 6 +- .../VS_Snippets_CFX/s_wcftomsmq/cs/client.cs | 10 +- .../VS_Snippets_CFX/s_wcftomsmq/cs/order.cs | 4 +- .../VS_Snippets_CFX/s_wcftomsmq/cs/proxy.cs | 4 +- .../s_wsdl_client/cs/generatedclient.cs | 42 +- .../s_wsdl_client/cs/service.cs | 2 +- .../sca.callbackcontract/cs/client.cs | 2 +- .../sca.callbackcontract/cs/proxycode.cs | 26 +- .../cs/generatedproxy.cs | 50 +- .../sca.session/cs/proxycode.cs | 26 +- .../serializationguidelines/cs/source.cs | 20 +- .../servicemetadatabehavior/cs/client.cs | 4 +- .../cs/hostapplication.cs | 18 +- .../servicemetadatabehavior/cs/proxycode.cs | 34 +- .../servicethrottlingbehavior/cs/client.cs | 4 +- .../servicethrottlingbehavior/cs/proxycode.cs | 22 +- .../syndicationmapping/cs/program.cs | 2 +- .../syndicationmapping/cs/snippets.cs | 2 +- .../trustedsubsystems/cs/source.cs | 10 +- .../trustedsubsystemsclient/cs/source.cs | 2 +- .../trustedsubsystemsresource/cs/source.cs | 2 +- .../cs/committabletxwithsql.cs | 6 +- .../VS_Snippets_CFX/tx_enlist/cs/enlist.cs | 6 +- .../wf_svchost_idle_persist/cs/source.cs | 8 +- .../x509accessible/cs/source.cs | 116 ++-- .../ADApplicationBase/CS/adapplicationbase.cs | 6 +- .../AppDomain_Setup/CS/setup.cs | 4 +- .../AppDomain_Setup/CS/source2.cs | 2 +- .../AsyncDelegateExamples/CS/EndInvoke.cs | 8 +- .../AsyncDelegateExamples/CS/TestMethod.cs | 6 +- .../AsyncDelegateExamples/CS/callback.cs | 20 +- .../AsyncDelegateExamples/CS/polling.cs | 6 +- .../AsyncDelegateExamples/CS/waithandle.cs | 8 +- .../CS/AsyncDelegateNoStateObject.cs | 10 +- .../CS/AsyncDelegateWithStateObject.cs | 26 +- .../AsyncDesignPattern/CS/Async_EndBlock.cs | 2 +- .../CS/Async_EndBlockWait.cs | 4 +- .../AsyncDesignPattern/CS/Async_Poll.cs | 4 +- .../AsyncDesignPattern/CS/Factorizer.cs | 48 +- .../Asynchronous_File_IO_async/cs/example2.cs | 14 +- .../Asynchronous_File_IO_async/cs/example3.cs | 4 +- .../CatchException/CS/catchexception.cs | 10 +- .../CodeDOM Class Sample/CS/SampleCode.cs | 22 +- .../CodeDOM Class Sample/CS/program.cs | 14 +- .../CodeDomExample/CS/source.cs | 14 +- .../CodeDomHelloWorldSample/cs/program.cs | 10 +- .../CS/codetrycatchfinallyexample.cs | 34 +- .../Conceptual.AsyncInterop/cs/APM1.cs | 20 +- .../Conceptual.AsyncInterop/cs/APM2.cs | 32 +- .../Conceptual.AsyncInterop/cs/EAP1.cs | 6 +- .../Conceptual.AsyncInterop/cs/Semaphore1.cs | 4 +- .../Conceptual.AsyncInterop/cs/Stream1.cs | 6 +- .../Conceptual.AsyncInterop/cs/Wait1.cs | 8 +- .../Conceptual.AsyncInterop/cs/Wrap1.cs | 12 +- .../Conceptual.AsyncInterop/cs/Wrap2.cs | 18 +- .../Conceptual.Interop.PInvoke/cs/Example1.cs | 4 +- .../Conceptual.StringBuilder/cs/Example.cs | 8 +- .../cs/Sleep1.cs | 14 +- .../CryptoWalkThru/cs/Form1.Designer.cs | 52 +- .../CryptoWalkThru/cs/Form1.cs | 2 +- .../Cryptography.SmartCardCSP/CS/example.cs | 6 +- .../CustomAttributeData/CS/source.cs | 30 +- .../VS_Snippets_CLR/DPAPI-HowTO/cs/sample.cs | 6 +- .../DynamicMethodHowTo/cs/source.cs | 66 +-- .../EmitGenericType/CS/source.cs | 112 ++-- .../Exception.Throwing/CS/throw.cs | 6 +- .../Formatting.Composite/cs/Composite1.cs | 16 +- .../Formatting.Composite/cs/Escaping1.cs | 4 +- .../cs/Custom1.cs | 144 ++--- .../cs/LiteralsEx1.cs | 12 +- .../cs/LiteralsEx2.cs | 10 +- .../cs/LiteralsEx3.cs | 10 +- .../cs/custandformatting1.cs | 8 +- .../cs/custandparsing1.cs | 10 +- .../cs/escape1.cs | 2 +- .../cs/literal1.cs | 2 +- .../cs/parseexact2digityear1.cs | 12 +- .../cs/Roundtrip1.cs | 14 +- .../cs/Standard1.cs | 166 +++--- .../Formatting.DateAndTime.Standard/cs/o1.cs | 16 +- .../Formatting.Enum/cs/enum1.cs | 32 +- .../Formatting.HowTo.Calendar/cs/Calendar1.cs | 40 +- .../cs/Millisecond.cs | 34 +- .../cs/Telephone1.cs | 26 +- .../Formatting.HowTo.PadNumber/cs/Pad1.cs | 38 +- .../cs/RoundTrip.cs | 78 +-- .../Formatting.HowTo.WeekdayName/cs/Howto1.cs | 2 +- .../cs/abbrname1.cs | 2 +- .../cs/abbrname2.cs | 6 +- .../cs/example6.cs | 20 +- .../cs/fullname4.cs | 2 +- .../cs/fullname5.cs | 4 +- .../cs/weekdaynumber7.cs | 2 +- .../cs/Standard.cs | 92 +-- .../cs/standardusage1.cs | 2 +- .../GCNotification/cs/Program.cs | 28 +- .../GenericMethodHowTo/CS/source.cs | 82 +-- .../HookUpDelegate/cs/source.cs | 36 +- .../HowToDecryptXMLElementX509/cs/sample.cs | 2 +- .../HowToEmitCodeInPartialTrust/cs/source.cs | 82 +-- .../cs/sample.cs | 2 +- .../cs/sample.cs | 12 +- .../HowToEncryptXMLElementX509/cs/sample.cs | 10 +- .../HowToGeneric/CS/source2.cs | 2 +- .../VS_Snippets_CLR/HowToGeneric/CS/ur.cs | 26 +- .../HowToSignXMLDocumentRSA/cs/sample.cs | 8 +- .../HowToVerifyXMLDocumentRSA/cs/sample.cs | 10 +- .../IO.Compression.GZip1/CS/gziptest.cs | 4 +- .../RegularExpressions.Classes/cs/Example.cs | 44 +- .../cs/Example_ChangeDateFormats1.cs | 8 +- .../cs/Example.cs | 10 +- .../cs/example2.cs | 18 +- .../cs/example3.cs | 36 +- .../cs/example.cs | 12 +- .../cs/Example.cs | 4 +- .../cs/example2.cs | 2 +- .../cs/Example.cs | 8 +- .../cs/Quantifiers1.cs | 92 +-- .../appcompat.sslprotocols/cs/program.cs | 4 +- .../cocontravariancedelegates/cs/example.cs | 2 +- .../cs/example.cs | 2 +- .../cs/example.cs | 10 +- .../conceptual.attributes.usage/cs/source2.cs | 4 +- .../conceptual.basicio.textfiles/cs/source.cs | 12 +- .../cs/source2.cs | 2 +- .../cs/source5.cs | 2 +- .../conceptual.basicio.textfiles/cs/write.cs | 2 +- .../conceptual.calendars/cs/calendarinfo1.cs | 12 +- .../cs/changecalendar2.cs | 20 +- .../cs/currentcalendar1.cs | 10 +- .../cs/datesandcalendars2.cs | 32 +- .../conceptual.calendars/cs/formatstrings1.cs | 12 +- .../conceptual.calendars/cs/formatstrings2.cs | 2 +- .../conceptual.calendars/cs/formatstrings3.cs | 14 +- .../cs/instantiatehcdate1.cs | 10 +- .../cs/instantiatewithera1.cs | 8 +- .../cs/minsupporteddatetime1.cs | 22 +- .../cs/noncurrentcalendar1.cs | 4 +- .../cs/howtoexample1.cs | 2 +- .../cs/datetimereplacement1.cs | 6 +- .../cs/accessibility1.cs | 26 +- .../cs/accessibility3.cs | 10 +- .../conceptual.clscompliant/cs/array1.cs | 2 +- .../conceptual.clscompliant/cs/array2.cs | 4 +- .../conceptual.clscompliant/cs/array3.cs | 10 +- .../conceptual.clscompliant/cs/attribute1.cs | 8 +- .../conceptual.clscompliant/cs/attribute2.cs | 10 +- .../conceptual.clscompliant/cs/box2.cs | 4 +- .../conceptual.clscompliant/cs/convert1.cs | 28 +- .../conceptual.clscompliant/cs/ctor1.cs | 18 +- .../conceptual.clscompliant/cs/eii1.cs | 12 +- .../conceptual.clscompliant/cs/enum3.cs | 16 +- .../conceptual.clscompliant/cs/event1.cs | 46 +- .../conceptual.clscompliant/cs/exceptions1.cs | 8 +- .../conceptual.clscompliant/cs/exceptions2.cs | 8 +- .../conceptual.clscompliant/cs/generics2.cs | 28 +- .../conceptual.clscompliant/cs/generics2a.cs | 28 +- .../conceptual.clscompliant/cs/generics4.cs | 4 +- .../conceptual.clscompliant/cs/indicator3.cs | 12 +- .../conceptual.clscompliant/cs/naming1.cs | 8 +- .../conceptual.clscompliant/cs/naming3.cs | 8 +- .../cs/nestedgenerics2.cs | 12 +- .../conceptual.clscompliant/cs/paramarray1.cs | 8 +- .../conceptual.clscompliant/cs/public1.cs | 2 +- .../conceptual.clscompliant/cs/public2.cs | 2 +- .../conceptual.clscompliant/cs/type2.cs | 4 +- .../conceptual.clscompliant/cs/type3.cs | 14 +- .../cs/unmanagedptr1.cs | 4 +- .../conceptual.conversion/cs/convert1.cs | 70 +-- .../conceptual.conversion/cs/explicit1.cs | 64 +-- .../conceptual.conversion/cs/iconvertible1.cs | 2 +- .../conceptual.conversion/cs/iconvertible2.cs | 70 +-- .../conceptual.conversion/cs/implicit1.cs | 44 +- .../conceptual.crosslanguage/cs/numberutil.cs | 10 +- .../cs/useutilities1.cs | 30 +- .../conceptual.disposable/cs/base1.cs | 36 +- .../conceptual.disposable/cs/derived1.cs | 66 +-- .../conceptual.disposable/cs/dispose1.cs | 2 +- .../conceptual.disposable/cs/using1.cs | 2 +- .../conceptual.disposable/cs/using2.cs | 4 +- .../conceptual.disposable/cs/using3.cs | 8 +- .../conceptual.disposable/cs/using4.cs | 2 +- .../conceptual.disposable/cs/using5.cs | 12 +- .../conceptual.encoding/cs/bestfit1.cs | 12 +- .../conceptual.encoding/cs/bestfit1a.cs | 6 +- .../conceptual.encoding/cs/custom1.cs | 16 +- .../conceptual.encoding/cs/exceptionascii.cs | 20 +- .../conceptual.encoding/cs/getbytes1.cs | 32 +- .../conceptual.encoding/cs/getchars1.cs | 26 +- .../cs/replacementascii.cs | 8 +- .../conceptual.encoding/cs/stream1.cs | 46 +- .../conceptual.events.other/cs/example.cs | 2 +- .../cs/alias1.cs | 2 +- .../cs/appstandard1.cs | 22 +- .../cs/composite1.cs | 18 +- .../cs/culturespecific1.cs | 12 +- .../cs/culturespecific2.cs | 6 +- .../cs/culturespecific3.cs | 12 +- .../cs/culturespecific4.cs | 6 +- .../cs/custom1.cs | 4 +- .../cs/icustomformatter1.cs | 30 +- .../cs/iformattable.cs | 18 +- .../cs/overrides1.cs | 4 +- .../cs/specifier1.cs | 6 +- .../cs/standard1.cs | 2 +- .../cs/source2.cs | 4 +- .../conceptual.globalization/cs/codepages1.cs | 16 +- .../conceptual.globalization/cs/currency1.cs | 16 +- .../conceptual.globalization/cs/currency2.cs | 18 +- .../conceptual.globalization/cs/dates1.cs | 4 +- .../conceptual.globalization/cs/dates2.cs | 20 +- .../conceptual.globalization/cs/dates3.cs | 22 +- .../conceptual.globalization/cs/dates4.cs | 10 +- .../conceptual.globalization/cs/dates5.cs | 4 +- .../conceptual.globalization/cs/dates6.cs | 4 +- .../conceptual.globalization/cs/dates8.cs | 16 +- .../conceptual.globalization/cs/equals1.cs | 2 +- .../conceptual.globalization/cs/equals2.cs | 2 +- .../conceptual.globalization/cs/monthname1.cs | 4 +- .../conceptual.globalization/cs/monthname2.cs | 26 +- .../conceptual.globalization/cs/numbers1.cs | 20 +- .../conceptual.globalization/cs/numbers2.cs | 22 +- .../conceptual.globalization/cs/numbers3.cs | 24 +- .../conceptual.globalization/cs/search1.cs | 2 +- .../conceptual.globalization/cs/sort1.cs | 6 +- .../conceptual.globalization/cs/sortkey1.cs | 14 +- .../cs/arrays.cs | 14 +- .../conceptual.isolatedstorage/cs/source2.cs | 4 +- .../conceptual.isolatedstorage/cs/source5.cs | 2 +- .../conceptual.localizability/cs/ismetric1.cs | 4 +- .../cs/observer.cs | 2 +- .../cs/provider.cs | 2 +- .../cs/observer.cs | 6 +- .../cs/provider.cs | 2 +- .../cs/regsetting1.cs | 6 +- .../cs/endofstring1.cs | 6 +- .../cs/startofstring1.cs | 2 +- .../cs/any2.cs | 2 +- .../cs/classsubtraction1.cs | 6 +- .../cs/digit1.cs | 8 +- .../cs/getunicodecategory1.cs | 6 +- .../cs/nondigit1.cs | 6 +- .../cs/nonwhitespace1.cs | 4 +- .../cs/nonwordchar1.cs | 6 +- .../cs/notcategory1.cs | 2 +- .../cs/positivecharclasses.cs | 2 +- .../cs/wordchar1.cs | 6 +- .../cs/case1.cs | 4 +- .../cs/case2.cs | 4 +- .../cs/culture1.cs | 20 +- .../cs/determine1.cs | 2 +- .../cs/ecmascript1.cs | 4 +- .../cs/ecmascript2.cs | 18 +- .../cs/example1.cs | 18 +- .../cs/explicit1.cs | 6 +- .../cs/explicit2.cs | 4 +- .../cs/explicit3.cs | 4 +- .../cs/multiline1.cs | 18 +- .../cs/multiline2.cs | 16 +- .../cs/righttoleft1.cs | 2 +- .../cs/righttoleft2.cs | 2 +- .../cs/singleline1.cs | 2 +- .../cs/whitespace1.cs | 4 +- .../cs/whitespace2.cs | 4 +- .../cs/after1.cs | 2 +- .../cs/before1.cs | 2 +- .../cs/dollarsign1.cs | 4 +- .../cs/entire1.cs | 4 +- .../cs/entirematch1.cs | 6 +- .../cs/lastmatch1.cs | 2 +- .../conceptual.regex/cs/example.cs | 42 +- .../conceptual.regex/cs/example1.cs | 2 +- .../conceptual.regex/cs/example2.cs | 2 +- .../cs/backtracking1.cs | 2 +- .../cs/backtracking2.cs | 10 +- .../cs/backtracking3.cs | 4 +- .../cs/backtracking4.cs | 6 +- .../cs/backtracking5.cs | 4 +- .../cs/backtracking6.cs | 2 +- .../cs/backtrack2.cs | 6 +- .../cs/backtrack4.cs | 4 +- .../cs/compare1.cs | 16 +- .../cs/compile2.cs | 6 +- .../cs/design2.cs | 22 +- .../cs/group1.cs | 10 +- .../cs/group2.cs | 10 +- .../cs/static1.cs | 22 +- .../cs/static2.cs | 22 +- .../cs/timeout1.cs | 34 +- .../cs/conditional1.cs | 14 +- .../cs/lazy1.cs | 8 +- .../cs/lookbehind1.cs | 2 +- .../cs/nonbacktracking1.cs | 6 +- .../cs/nonbacktracking2.cs | 6 +- .../cs/rtl1.cs | 10 +- .../cs/capture1.cs | 4 +- .../cs/capturecollection1.cs | 10 +- .../cs/groupsyntax1.cs | 2 +- .../cs/lastcapture1.cs | 2 +- .../cs/match1.cs | 6 +- .../cs/match2.cs | 2 +- .../cs/match3.cs | 6 +- .../cs/matchcollection1.cs | 6 +- .../cs/matches1.cs | 4 +- .../cs/replace1.cs | 4 +- .../cs/result1.cs | 2 +- .../cs/split1.cs | 2 +- .../cs/validate1.cs | 2 +- .../cs/assemblyinfo.cs | 10 +- .../cs/program.cs | 4 +- .../cs/example1.cs | 4 +- .../cs/program.cs | 4 +- .../cs/program2.cs | 6 +- .../cs/uilibrary.cs | 34 +- .../cs/assemblyinfo.cs | 6 +- .../cs/blankpage.xaml.cs | 4 +- .../cs/richtextcolumns.cs | 2 +- .../cs/assemblyinfo.cs | 6 +- .../cs/blankpage.xaml.cs | 4 +- .../cs/richtextcolumns.cs | 2 +- .../cs/resources1.cs | 36 +- .../conceptual.resources.resx/cs/create1.cs | 36 +- .../cs/enumerate1.cs | 50 +- .../conceptual.resources.resx/cs/retrieve1.cs | 38 +- .../cs/createresources.cs | 4 +- .../cs/ctor1.cs | 4 +- .../cs/example.cs | 8 +- .../cs/example1.cs | 10 +- .../cs/example2.cs | 16 +- .../cs/example3.cs | 10 +- .../cs/getstream.cs | 4 +- .../cs/getstring.cs | 16 +- .../cs/example.cs | 6 +- .../cs/stringlibrary.cs | 2 +- .../cs/greeting.cs | 4 +- .../conceptual.string.basicops/cs/basicops.cs | 36 +- .../conceptual.string.basicops/cs/compare.cs | 4 +- .../conceptual.string.basicops/cs/trimming.cs | 2 +- .../cs/api1.cs | 8 +- .../cs/comparison1.cs | 8 +- .../cs/comparison2.cs | 8 +- .../cs/comparison3.cs | 12 +- .../cs/embeddednulls1.cs | 12 +- .../cs/embeddednulls2.cs | 8 +- .../cs/explicitargs1.cs | 10 +- .../cs/indirect1.cs | 24 +- .../cs/indirect2.cs | 10 +- .../cs/persistence.cs | 34 +- .../cs/settings1.cs | 6 +- .../cs/turkish1.cs | 20 +- .../cs/cultureinsensitive1.cs | 18 +- .../conceptual.tap/cs/examples1.cs | 20 +- .../conceptual.tap_patterns/cs/patterns1.cs | 32 +- .../cs/customexamples1.cs | 114 ++-- .../cs/customformatexample1.cs | 2 +- .../cs/customparseexample1.cs | 2 +- .../cs/f_specifiers1.cs | 92 +-- .../cs/fspecifiers1.cs | 10 +- .../conceptual.timespan.custom/cs/literal1.cs | 8 +- .../cs/negativevalues1.cs | 4 +- .../cs/formatexample1.cs | 4 +- .../cs/parseexample1.cs | 8 +- .../cs/standardc1.cs | 12 +- .../cs/standardlong1.cs | 14 +- .../cs/standardshort1.cs | 14 +- .../conceptual.types.dynamic/cs/source1.cs | 12 +- .../conceptual.types.dynamic/cs/source2.cs | 4 +- .../conceptual.types.enum/cs/example.cs | 8 +- .../cs/example.cs | 2 +- .../cs/example.cs | 6 +- .../contractexample/cs/program.cs | 6 +- .../eventsoverview/cs/programnodata.cs | 2 +- .../formatting.numeric.custom/cs/custom.cs | 126 ++--- .../formatting.numeric.custom/cs/escape1.cs | 4 +- .../formatting.numeric.custom/cs/example1.cs | 4 +- .../formatting.numeric.custom/literal2.cs | 2 +- .../generatingahash/cs/program.cs | 6 +- .../parsing.numbers/cs/formatproviders1.cs | 24 +- .../parsing.numbers/cs/styles1.cs | 4 +- .../parsing.numbers/cs/unicode1.cs | 10 +- .../portableclasslibrarymvvm/cs/customer.cs | 8 +- .../VS_Snippets_CLR/projectn/cs/compat2.cs | 2 +- .../VS_Snippets_CLR/projectn/cs/compat3.cs | 2 +- .../projectn/cs/makegenericmethod1.cs | 2 +- .../VS_Snippets_CLR/projectn/cs/serialize1.cs | 8 +- .../projectn/cs/type_makegenerictype1.cs | 4 +- .../VS_Snippets_CLR/projectn_etw/cs/etw1.cs | 14 +- .../VS_Snippets_CLR/projectn_etw/cs/etw2.cs | 14 +- .../cs/browsegenerictype1.cs | 10 +- .../cs/makegenerictype1.cs | 10 +- .../projectn_reflection/cs/method1.cs | 18 +- .../projectn_reflection/cs/property1.cs | 4 +- .../projectn_reflection/cs/propertyinfo1.cs | 10 +- .../projectn_reflection/cs/subtypes.cs | 4 +- .../cs/alternation1.cs | 10 +- .../cs/backreference1.cs | 2 +- .../cs/backreference2.cs | 2 +- .../cs/backreference3.cs | 2 +- .../cs/backreference5.cs | 6 +- .../cs/backreference6.cs | 2 +- .../cs/backreference7.cs | 2 +- .../cs/escape1.cs | 14 +- .../cs/grouping1.cs | 2 +- .../cs/grouping2.cs | 4 +- .../cs/grouping3.cs | 8 +- .../cs/lookahead1.cs | 8 +- .../cs/lookbehind1.cs | 2 +- .../cs/negativelookbehind1.cs | 12 +- .../cs/nonbacktracking1.cs | 4 +- .../cs/miscellaneous1.cs | 14 +- .../cs/miscellaneous2.cs | 4 +- .../cs/emptymatch1.cs | 12 +- .../cs/emptymatch4.cs | 26 +- .../cs/Change1.cs | 8 +- .../cs/ChangeUI1.cs | 8 +- .../cs/GetCultures1.cs | 18 +- .../cs/Optout1.cs | 8 +- .../cs/BackgroundEx1.cs | 14 +- .../System.Threading.Thread/cs/Instance1.cs | 14 +- .../cs/ThreadStart1.cs | 14 +- .../cs/ThreadStart2.cs | 14 +- .../cs/StandardFormats1.cs | 10 +- .../cs/Conversions.cs | 170 +++--- .../cs/Instantiate.cs | 120 ++-- .../cs/TimeConversions.cs | 4 +- .../cs/timeconversions2.cs | 8 +- .../cs/Conceptual1.cs | 18 +- .../cs/Conceptual2.cs | 22 +- .../cs/Conceptual3.cs | 12 +- .../cs/Conceptual4.cs | 12 +- .../cs/Conceptual5.cs | 14 +- .../cs/Conceptual6.cs | 24 +- .../cs/Conceptual8.cs | 20 +- .../cs/Methods.cs | 270 ++++----- .../cs/Methods2.cs | 28 +- .../cs/Methods3.cs | 28 +- .../system.Double.ToString/cs/ToString1.cs | 108 ++-- .../system.Double.ToString/cs/ToString7.cs | 4 +- .../system.Double/CS/doublesample.cs | 78 +-- .../cs/format.cs | 8 +- .../CS/source6.cs | 2 +- .../system.IO.Directory/CS/class1.cs | 78 +-- .../system.IO.Directory/CS/class6.cs | 2 +- .../system.IO.Directory_Copy/cs/program.cs | 2 +- .../system.IO.StreamReader/CS/asyncex1.cs | 2 +- .../system.IO.StreamReader/CS/example42.cs | 2 +- .../system.IO.StreamReader/CS/program.cs | 2 +- .../CS/streamreadersample.cs | 66 +-- .../CS/gethashcode.cs | 4 +- .../system.String.GetHashCode/CS/perdomain.cs | 22 +- .../CS/source.cs | 22 +- .../CS/source4.cs | 16 +- .../system.Threading.Timer/CS/source.cs | 20 +- .../CS/TimeZone2Concepts.cs | 140 ++--- .../cs/System.TimeZone2.CreateTimeZone.cs | 108 ++-- .../cs/Serialization.cs | 24 +- .../cs/Serialization2.cs | 46 +- .../system.X.ToString-and-Culture/cs/xts.cs | 128 ++--- .../cs/example.cs | 6 +- .../cs/example.cs | 6 +- .../cs/example.cs | 4 +- .../cs/program.cs | 24 +- .../cs/asyncculture1.cs | 20 +- .../cs/asyncculture2.cs | 24 +- .../cs/asyncculture3.cs | 24 +- .../cs/asyncculture4.cs | 28 +- .../cs/totitlecase2.cs | 2 +- .../system.idisposable/cs/base1.cs | 14 +- .../system.idisposable/cs/base2.cs | 14 +- .../system.idisposable/cs/calling1.cs | 16 +- .../system.idisposable/cs/calling2.cs | 18 +- .../system.idisposable/cs/derived1.cs | 20 +- .../system.idisposable/cs/derived2.cs | 24 +- .../cs/program1.cs | 2 +- .../cs/program2.cs | 8 +- .../cs/program3.cs | 4 +- .../cs/program4.cs | 4 +- .../cs/program.cs | 2 +- .../system.io.enumdirs1/cs/program.cs | 2 +- .../cs/blankpage2.xaml.cs | 2 +- .../cs/blankpage3.xaml.cs | 2 +- .../cs/blankpage4.xaml.cs | 2 +- .../cs/mainpage.xaml.cs | 2 +- .../cs/mainpage1.xaml.cs | 2 +- .../cs/mainpage.xaml.cs | 4 +- .../cs/ctor1.cs | 38 +- .../cs/parallelforcancel.cs | 2 +- .../cs/parallelintro.cs | 2 +- .../cs/threadlocalforwithoptions.cs | 2 +- .../cs/mainpage.xaml.cs | 2 +- .../DLinqAdoNet/cs/Program.cs | 2 +- .../DLinqAdoNet/cs/northwind.cs | 34 +- .../DLinqCRUDOps/cs/northwind.cs | 34 +- .../DLinqCascadeWorkaround/cs/northwind.cs | 34 +- .../cs/Program.cs | 4 +- .../cs/northwind.cs | 34 +- .../DLinqCompositeKeys/cs/northwind.cs | 34 +- .../DLinqDataBinding/cs/northwind.cs | 34 +- .../DLinqDebuggingSupport/cs/Program.cs | 4 +- .../DLinqDebuggingSupport/cs/northwind.cs | 34 +- .../DLinqGettingStarted/cs/Program.cs | 2 +- .../DLinqGettingStarted/cs/northwind.cs | 34 +- .../DLinqLocalMethodCall/cs/northwind.cs | 36 +- .../DLinqObjectIdentity/cs/Program.cs | 4 +- .../DLinqObjectIdentity/cs/northwind.cs | 34 +- .../DLinqObjectModel/cs/northwind.cs | 34 +- .../DLinqOverrideDefault/cs/northwind.cs | 34 +- .../DLinqOverrideDefaultSproc/cs/northwind.cs | 38 +- .../DLinqQueryConcepts/cs/Program.cs | 4 +- .../DLinqQueryConcepts/cs/northwind.cs | 34 +- .../DLinqQueryExamples/cs/northwind.cs | 34 +- .../DLinqQuerying/cs/northwind.cs | 34 +- .../DLinqSQOTranslation/cs/Program.cs | 2 +- .../DLinqSQOTranslation/cs/northwind.cs | 34 +- .../DLinqSerialization/cs/Program.cs | 2 +- .../DLinqSerialization/cs/northwind-ser.cs | 38 +- .../VS_Snippets_Data/DLinqSprox/cs/Program.cs | 2 +- .../DLinqSprox/cs/northwind-sprox.cs | 34 +- .../DLinqSubmittingChanges/cs/Program.cs | 2 +- .../DLinqSubmittingChanges/cs/northwind.cs | 34 +- .../VS_Snippets_Data/DLinqUDFS/cs/Program.cs | 2 +- .../DLinqUDFS/cs/northwind-tfunc.cs | 34 +- .../DLinqWalk1CS/cs/Program.cs | 2 +- .../DLinqWalk2CS/cs/Program.cs | 4 +- .../DLinqWalk3CS/cs/northwind.cs | 34 +- .../DLinqWalk4CS/cs/Form1.Designer.cs | 28 +- .../DLinqWalk4CS/cs/northwind.cs | 34 +- .../DP L2E Conceptual Examples/CS/Program.cs | 100 ++-- .../CS/adventureworksmodel.designer.cs | 530 +++++++++--------- .../DP L2E Examples/CS/Program.cs | 50 +- .../CS/adventureworksmodel.designer.cs | 530 +++++++++--------- .../CS/AdventureWorksModel.Designer.cs | 530 +++++++++--------- .../cs/school.designer.cs | 254 ++++----- .../cs/entitysql.cs | 404 ++++++------- .../cs/adventureworks.designer.cs | 512 ++++++++--------- .../cs/adventureworksmodel.designer.cs | 262 ++++----- .../cs/entitysql.cs | 352 ++++++------ .../cs/schoolmodel.designer.cs | 244 ++++---- .../dp entityservices concepts/cs/source.cs | 72 +-- .../cs/adventureworksmodel.designer.cs | 530 +++++++++--------- .../cs/program.cs | 14 +- .../cs/adventureworks.designer.cs | 530 +++++++++--------- .../cs/school.designer.cs | 254 ++++----- .../cs/default.aspx.designer.cs | 8 +- .../astoria_custom_feeds/cs/iupdatable.cs | 2 +- .../cs/northwind.designer.cs | 156 +++--- .../cs/northwind.objects.cs | 8 +- .../astoria_custom_feeds/cs/northwind.svc.cs | 4 +- .../astoria_custom_feeds/cs/orderitems.svc.cs | 8 +- .../cs/default.aspx.designer.cs | 6 +- .../astoria_linq_provider/cs/northwind.cs | 2 +- .../cs/northwind.designer.cs | 16 +- .../astoria_linq_provider/cs/northwind.svc.cs | 6 +- .../cs/clientcredentials.xaml.cs | 6 +- .../cs/customerorders.designer.cs | 16 +- .../cs/customerorders2.cs | 2 +- .../cs/customerorders2.designer.cs | 112 ++-- .../cs/customerordersasync.xaml.cs | 8 +- .../cs/customerorderscustom.xaml.cs | 14 +- .../cs/customerorderswpf.xaml.cs | 2 +- .../cs/customerorderswpf3.xaml.cs | 8 +- .../astoria_northwind_client/cs/northwind.cs | 4 +- .../astoria_northwind_client/cs/northwind1.cs | 4 +- .../cs/salesorders.xaml.cs | 4 +- .../astoria_northwind_client/cs/source.cs | 208 +++---- .../customeraddressnonentitytest.cs | 2 +- .../astoriasnippetscs/customeraddresstest.cs | 2 +- .../astoriasnippetscs/customerorders2test.cs | 2 +- .../customerordersasynctest.cs | 2 +- .../customerorderscustomtest.cs | 2 +- .../astoriasnippetscs/customerorderstest.cs | 2 +- .../customerorderswpf2test.cs | 2 +- .../customerorderswpf3test.cs | 2 +- .../customerorderswpftest.cs | 2 +- .../astoriasnippetscs/salesorderstest.cs | 2 +- .../astoriasnippetscs/sourcetest.cs | 2 +- .../cs/default.aspx.designer.cs | 6 +- .../cs/northwind.designer.cs | 346 ++++++------ .../cs/northwind.svc.cs | 2 +- .../cs/northwind2.svc.cs | 14 +- .../cs/photodata.cs | 8 +- .../cs/photodetailswindow.xaml.cs | 12 +- .../cs/photowindow.xaml.cs | 4 +- .../cs/customcompression.cs | 8 +- .../cs/photodata.svc.cs | 2 +- .../cs/photoservicestreamprovider.cs | 22 +- .../cs/settings.cs | 6 +- .../astoria_quickstart_client/cs/northwind.cs | 4 +- .../cs/window1.xaml.cs | 8 +- .../cs/default.aspx.designer.cs | 6 +- .../cs/northwind.designer.cs | 26 +- .../cs/northwind.svc.cs | 4 +- samples/snippets/csharp/buffers/MyClass.cs | 6 +- .../csharp/classes-quickstart/BankAccount.cs | 2 +- .../concepts/basic-types/type-safety.cs | 2 +- .../csharp/concepts/codedoc/exception-tag.cs | 4 +- .../csharp/concepts/codedoc/inheritdoc-tag.cs | 2 +- .../csharp/concepts/codedoc/param-tag.cs | 2 +- .../csharp/concepts/codedoc/paramref-tag.cs | 2 +- .../csharp/concepts/codedoc/see-tag.cs | 4 +- .../csharp/concepts/codedoc/seealso-tag.cs | 2 +- .../csharp/concepts/codedoc/tagged-library.cs | 4 +- .../linq/how-to-create-a-nested-group_1.cs | 6 +- ...-specify-predicate-filters-at-runtime_2.cs | 2 +- .../linq/how-to-group-query-results_1.cs | 42 +- .../linq/how-to-group-query-results_2.cs | 4 +- .../linq/how-to-group-query-results_3.cs | 4 +- .../linq/how-to-group-query-results_5.cs | 6 +- .../linq/how-to-group-query-results_6.cs | 4 +- .../linq/how-to-group-query-results_7.cs | 4 +- ...w-to-group-results-by-contiguous-keys_1.cs | 14 +- ...andle-exceptions-in-query-expressions_1.cs | 4 +- ...to-order-the-results-of-a-join-clause_1.cs | 4 +- ...how-to-perform-custom-join-operations_1.cs | 4 +- ...how-to-perform-custom-join-operations_2.cs | 2 +- .../linq/how-to-perform-grouped-joins_1.cs | 2 +- .../linq/how-to-perform-inner-joins_3.cs | 6 +- .../linq/how-to-perform-inner-joins_4.cs | 2 +- .../how-to-query-a-collection-of-objects_1.cs | 42 +- .../how-to-return-a-query-from-a-method_1.cs | 4 +- .../snippets/csharp/concepts/linq/index_1.cs | 4 +- .../linq/query-expression-basics_5.cs | 4 +- .../linq/query-expression-basics_8.cs | 2 +- .../csharp/concepts/methods/async1.cs | 2 +- .../csharp/concepts/methods/byref108.cs | 4 +- .../csharp/concepts/methods/byvalue42.cs | 2 +- .../csharp/concepts/methods/methods40.cs | 6 +- .../csharp/concepts/methods/named1.cs | 6 +- .../csharp/concepts/methods/named2.cs | 6 +- .../csharp/concepts/methods/optional1.cs | 4 +- .../csharp/concepts/methods/overridden1.cs | 4 +- .../csharp/concepts/methods/params74.cs | 2 +- .../csharp/concepts/methods/returnarray1.cs | 8 +- .../csharp/concepts/methods/swap107.cs | 2 +- .../csharp/delegates-and-events/FileLogger.cs | 4 +- .../csharp/delegates-and-events/Logger.cs | 8 +- .../csharp/delegates-and-events/Program.cs | 4 +- .../migration-guide/versions-installed1.cs | 6 +- .../migration-guide/versions-installed3.cs | 16 +- .../getting-started/console-linq/Program.cs | 2 +- .../console-linq/extensions.cs | 4 +- .../console-linq/playingcard.cs | 4 +- .../console-teleprompter/Program.cs | 2 +- .../console-webapiclient/Repository.cs | 2 +- .../ClassLibraryProjects/ShowCase/Program.cs | 8 +- .../with_visual_studio_2017/showcase.cs | 8 +- .../how-to/safelycast/asandis/Program.cs | 2 +- .../csharp/how-to/strings/CompareStrings.cs | 10 +- .../csharp/how-to/strings/ModifyStrings.cs | 6 +- .../how-to/strings/ParseStringsUsingSplit.cs | 2 +- .../csharp/how-to/strings/SearchStrings.cs | 4 +- .../interfaces/ExplicitImplementation.cs | 4 +- .../snippets/csharp/interfaces/properties.cs | 4 +- .../csharp/keywords/FixedKeywordExamples.cs | 18 +- .../keywords/IterationKeywordsExamples.cs | 2 +- .../InParameterModifier.cs | 2 +- .../OutParameterModifier.cs | 4 +- .../RefParameterModifier.cs | 10 +- .../keywords/is/is-const-pattern11.cs | 4 +- .../keywords/is/is-const-pattern7.cs | 2 +- .../keywords/is/is-type-pattern10.cs | 10 +- .../keywords/is/is-type-pattern9.cs | 10 +- .../keywords/is/is-var-pattern8.cs | 6 +- .../keywords/switch/const-pattern.cs | 2 +- .../keywords/switch/switch1.cs | 2 +- .../keywords/switch/switch2.cs | 2 +- .../keywords/switch/switch3.cs | 4 +- .../keywords/switch/switch3a.cs | 2 +- .../keywords/switch/switch4.cs | 22 +- .../keywords/switch/switch5.cs | 8 +- .../keywords/switch/type-pattern.cs | 2 +- .../keywords/switch/type-pattern2.cs | 4 +- .../keywords/switch/type-pattern3.cs | 2 +- .../keywords/switch/when-clause.cs | 32 +- .../keywords/throw/coalescing.cs | 6 +- .../keywords/throw/conditional.cs | 10 +- .../keywords/throw/exp-bodied.cs | 2 +- .../keywords/throw/throw-1.cs | 4 +- .../keywords/throw/throw-3.cs | 6 +- .../keywords/using/using-static1.cs | 2 +- .../keywords/using/using-static2.cs | 2 +- .../keywords/using/using-static3.cs | 6 +- .../language-reference/keywords/verbatim1.cs | 12 +- .../language-reference/keywords/verbatim2.cs | 6 +- .../keywords/volatile/Program.cs | 2 +- .../language-reference/keywords/when/catch.cs | 4 +- .../language-reference/keywords/when/when.cs | 24 +- .../tokens/string-interpolation.cs | 6 +- samples/snippets/csharp/misc/cs4009-1.cs | 2 +- samples/snippets/csharp/misc/cs4009-2.cs | 2 +- samples/snippets/csharp/misc/cs4009-3.cs | 2 +- .../snippets/csharp/new-in-6/NetworkClient.cs | 4 +- samples/snippets/csharp/new-in-6/Program.cs | 4 +- samples/snippets/csharp/new-in-6/overloads.cs | 6 +- samples/snippets/csharp/new-in-6/viewmodel.cs | 4 +- .../snippets/csharp/new-in-7/MathUtilities.cs | 4 +- samples/snippets/csharp/new-in-7/Point.cs | 4 +- .../csharp/objectoriented/Inheritance.cs | 20 +- .../csharp/objectoriented/interfaces.cs | 4 +- samples/snippets/csharp/pipelines/DoNotUse.cs | 2 +- .../snippets/csharp/pipelines/MyConnection.cs | 4 +- .../csharp/pipelines/MyConnection1.cs | 4 +- .../snippets/csharp/pipelines/MyPipeWriter.cs | 4 +- .../csharp/pipelines/ReadSingleMsg.cs | 10 +- .../classes-and-structs/class1.cs | 2 +- .../classes-and-structs/constructors1.cs | 8 +- .../classes-and-structs/expr-bodied-ctor.cs | 4 +- .../expr-bodied-destructor.cs | 2 +- .../expr-bodied-indexers.cs | 6 +- .../expr-bodied-methods.cs | 2 +- .../expr-bodied-readonly.cs | 2 +- .../local-functions-async1.cs | 8 +- .../local-functions-async2.cs | 10 +- .../local-functions-iterator1.cs | 8 +- .../local-functions-iterator2.cs | 8 +- .../classes-and-structs/local-functions1.cs | 8 +- .../BasicObjectInitializers.cs | 12 +- .../HowToDictionaryInitializer.cs | 2 +- .../HowToObjectInitializers.cs | 22 +- .../classes-and-structs/properties-1.cs | 4 +- .../classes-and-structs/properties-2.cs | 4 +- .../classes-and-structs/properties-3.cs | 6 +- .../classes-and-structs/properties-4.cs | 2 +- .../deconstructing-tuples/class-discard1.cs | 4 +- .../deconstruct-class2.cs | 4 +- .../deconstruct-extension1.cs | 10 +- .../deconstructing-tuples/discard-tuple1.cs | 6 +- .../discards/discard-out1.cs | 6 +- .../discards/discard-pattern2.cs | 6 +- .../discards/standalone-discard1.cs | 6 +- .../discards/standalone-discard2.cs | 16 +- .../programming-guide/indexers/indexer-2.cs | 6 +- .../programming-guide/indexers/indexer-3.cs | 4 +- .../ExpressionAndStatementLambdas.cs | 4 +- .../VariableScopeWithLambdas.cs | 4 +- .../ref-returns/NumberStore.cs | 2 +- .../ref-returns/NumberStoreUpdated.cs | 2 +- .../programming-guide/ref-returns/Program.cs | 2 +- .../parse-tryparse2/Program.cs | 4 +- .../programming-guide/strings/Strings_1.cs | 8 +- .../roslyn-sdk/SemanticQuickStart/Program.cs | 4 +- .../HelloSyntaxTree/Program.cs | 2 +- .../SyntaxQuickStart/SyntaxWalker/Program.cs | 10 +- .../ConstructionCS/Program.cs | 4 +- .../TransformationCS/Program.cs | 4 +- .../TransformationCS/TypeInferenceRewriter.cs | 2 +- .../safe-efficient-code/benchmark/Program.cs | 2 +- .../ref-readonly-struct/Point3D.cs | 2 +- .../snippets/csharp/tour/arrays/Program.cs | 8 +- .../csharp/tour/attributes/Program.cs | 6 +- .../csharp/tour/classes-and-objects/Color.cs | 2 +- .../csharp/tour/classes-and-objects/Entity.cs | 10 +- .../tour/classes-and-objects/Expressions.cs | 18 +- .../classes-and-objects/ListBasedExamples.cs | 40 +- .../tour/classes-and-objects/OutExample.cs | 4 +- .../tour/classes-and-objects/Overloading.cs | 14 +- .../csharp/tour/classes-and-objects/Point.cs | 6 +- .../tour/classes-and-objects/Program.cs | 2 +- .../tour/classes-and-objects/RefExample.cs | 4 +- .../tour/classes-and-objects/Squares.cs | 4 +- .../snippets/csharp/tour/delegates/Program.cs | 12 +- .../csharp/tour/interfaces/Program.cs | 2 +- .../csharp/tour/program-structure/Program.cs | 8 +- .../csharp/tour/statements/Program.cs | 70 +-- samples/snippets/csharp/tuples/Person.cs | 10 +- samples/snippets/csharp/tuples/Program.cs | 10 +- .../csharp/tuples/ProjectionSample.cs | 4 +- samples/snippets/csharp/tuples/Statistics.cs | 2 +- .../csharp/tutorials/attributes/Program.cs | 12 +- .../tutorials/inheritance/base-and-derived.cs | 36 +- .../csharp/tutorials/inheritance/is-a.cs | 2 +- .../csharp/tutorials/inheritance/private.cs | 4 +- .../csharp/tutorials/inheritance/shape.cs | 28 +- .../tutorials/inheritance/use-publication.cs | 38 +- .../mixins-with-interfaces/Program.cs | 2 +- .../UnusedExampleCode.cs | 6 +- .../introduction-to-wpf_34.cs | 2 +- .../csharp/Program.cs | 28 +- .../MovieRecommendation/csharp/Program.cs | 8 +- .../csharp/Program.cs | 22 +- .../SentimentAnalysis/csharp/Program.cs | 28 +- .../TaxiFarePrediction/csharp/Program.cs | 6 +- .../TextClassificationTF/csharp/Program.cs | 10 +- .../TransferLearningTF/csharp/Program.cs | 20 +- .../base-types/format-strings/biginteger-r.cs | 6 +- .../getting-started/ref-returns.cs | 12 +- 1041 files changed, 10000 insertions(+), 10000 deletions(-) diff --git a/docs/csharp/language-reference/builtin-types/snippets/NullableValueTypes.cs b/docs/csharp/language-reference/builtin-types/snippets/NullableValueTypes.cs index 725de5eeabfcc..3479859c0c041 100644 --- a/docs/csharp/language-reference/builtin-types/snippets/NullableValueTypes.cs +++ b/docs/csharp/language-reference/builtin-types/snippets/NullableValueTypes.cs @@ -28,7 +28,7 @@ private static void DeclareAndAssign() int? m = m2; bool? flag = null; - + // An array of a nullable value type: int?[] arr = new int?[10]; // diff --git a/docs/csharp/language-reference/builtin-types/snippets/VoidType.cs b/docs/csharp/language-reference/builtin-types/snippets/VoidType.cs index c4f4070972ec2..e075f36e58ef8 100644 --- a/docs/csharp/language-reference/builtin-types/snippets/VoidType.cs +++ b/docs/csharp/language-reference/builtin-types/snippets/VoidType.cs @@ -17,7 +17,7 @@ public static void Display(IEnumerable numbers) { return; } - + Console.WriteLine(string.Join(" ", numbers)); } // diff --git a/docs/csharp/language-reference/operators/snippets/AdditionOperator.cs b/docs/csharp/language-reference/operators/snippets/AdditionOperator.cs index 3783a8af458b1..1f0878a56e1af 100644 --- a/docs/csharp/language-reference/operators/snippets/AdditionOperator.cs +++ b/docs/csharp/language-reference/operators/snippets/AdditionOperator.cs @@ -64,7 +64,7 @@ private static void AddAndAssign() Action printer = () => Console.Write("a"); printer(); // output: a - + Console.WriteLine(); printer += () => Console.Write("b"); printer(); // output: ab diff --git a/docs/csharp/language-reference/operators/snippets/ArithmeticOperators.cs b/docs/csharp/language-reference/operators/snippets/ArithmeticOperators.cs index 4842a262b1891..cef3adba4f60c 100644 --- a/docs/csharp/language-reference/operators/snippets/ArithmeticOperators.cs +++ b/docs/csharp/language-reference/operators/snippets/ArithmeticOperators.cs @@ -9,10 +9,10 @@ public static void Examples() Console.WriteLine("==== ++ and -- operators"); Increment(); Decrement(); - + Console.WriteLine("==== Unary + and - operators"); UnaryPlusAndMinus(); - + Console.WriteLine("==== *, /, %, +, and - operators"); Multiplication(); IntegerDivision(); @@ -22,14 +22,14 @@ public static void Examples() FloatingPointRemainder(); Addition(); Subtraction(); - + Console.WriteLine("==== Precedence and associativity examples"); PrecedenceAndAssociativity(); - + Console.WriteLine("==== Compound assignment"); CompoundAssignment(); CompoundAssignmentWithCast(); - + Console.WriteLine("==== Special cases"); CheckedUnchecked(); FloatingPointOverflow(); @@ -200,7 +200,7 @@ private static void CompoundAssignmentWithCast() // byte a = 200; byte b = 100; - + var c = a + b; Console.WriteLine(c.GetType()); // output: System.Int32 Console.WriteLine(c); // output: 300 diff --git a/docs/csharp/language-reference/operators/snippets/AssignmentOperator.cs b/docs/csharp/language-reference/operators/snippets/AssignmentOperator.cs index a93ad26602a83..60e8f43e129ba 100644 --- a/docs/csharp/language-reference/operators/snippets/AssignmentOperator.cs +++ b/docs/csharp/language-reference/operators/snippets/AssignmentOperator.cs @@ -39,7 +39,7 @@ private static void RefAssignment() { // void Display(double[] s) => Console.WriteLine(string.Join(" ", s)); - + double[] arr = { 0.0, 0.0, 0.0 }; Display(arr); diff --git a/docs/csharp/language-reference/operators/snippets/AwaitOperator.cs b/docs/csharp/language-reference/operators/snippets/AwaitOperator.cs index 31031ed9cd7ec..2d77059bf41da 100644 --- a/docs/csharp/language-reference/operators/snippets/AwaitOperator.cs +++ b/docs/csharp/language-reference/operators/snippets/AwaitOperator.cs @@ -16,10 +16,10 @@ public static async Task Main() private static async Task DownloadDocsMainPageAsync() { Console.WriteLine($"{nameof(DownloadDocsMainPageAsync)}: About to start downloading."); - + var client = new HttpClient(); byte[] content = await client.GetByteArrayAsync("https://docs.microsoft.com/en-us/"); - + Console.WriteLine($"{nameof(DownloadDocsMainPageAsync)}: Finished downloading."); return content.Length; } diff --git a/docs/csharp/language-reference/operators/snippets/BitwiseAndShiftOperators.cs b/docs/csharp/language-reference/operators/snippets/BitwiseAndShiftOperators.cs index ea04231d450f3..3370b8778c320 100644 --- a/docs/csharp/language-reference/operators/snippets/BitwiseAndShiftOperators.cs +++ b/docs/csharp/language-reference/operators/snippets/BitwiseAndShiftOperators.cs @@ -136,7 +136,7 @@ private static void ShiftCount() // int count1 = 0b_0000_0001; int count2 = 0b_1110_0001; - + int a = 0b_0001; Console.WriteLine($"{a} << {count1} is {a << count1}; {a} << {count2} is {a << count2}"); // Output: diff --git a/docs/csharp/language-reference/operators/snippets/BooleanLogicalOperators.cs b/docs/csharp/language-reference/operators/snippets/BooleanLogicalOperators.cs index 84228a61df771..8e87572865b98 100644 --- a/docs/csharp/language-reference/operators/snippets/BooleanLogicalOperators.cs +++ b/docs/csharp/language-reference/operators/snippets/BooleanLogicalOperators.cs @@ -34,12 +34,12 @@ private static void Negation() private static void And() { // - bool SecondOperand() + bool SecondOperand() { Console.WriteLine("Second operand is evaluated."); return true; } - + bool a = false & SecondOperand(); Console.WriteLine(a); // Output: @@ -57,12 +57,12 @@ bool SecondOperand() private static void Or() { // - bool SecondOperand() + bool SecondOperand() { Console.WriteLine("Second operand is evaluated."); return true; } - + bool a = true | SecondOperand(); Console.WriteLine(a); // Output: @@ -138,7 +138,7 @@ private static void WithNullableBoolean() Display(!test); // output: null Display(test ^ false); // output: null Display(test ^ null); // output: null - Display(true ^ null); // output: null + Display(true ^ null); // output: null void Display(bool? b) => Console.WriteLine(b is null ? "null" : b.Value.ToString()); // @@ -164,7 +164,7 @@ private static void Precedence() // Console.WriteLine(true | true & false); // output: True Console.WriteLine((true | true) & false); // output: False - + bool Operand(string name, bool value) { Console.WriteLine($"Operand {name} is evaluated."); diff --git a/docs/csharp/language-reference/operators/snippets/ConditionalOperator.cs b/docs/csharp/language-reference/operators/snippets/ConditionalOperator.cs index 3562e80704b92..a4bbd01f0fc9a 100644 --- a/docs/csharp/language-reference/operators/snippets/ConditionalOperator.cs +++ b/docs/csharp/language-reference/operators/snippets/ConditionalOperator.cs @@ -49,7 +49,7 @@ private static void ComparisonWithIf() { // int input = new Random().Next(-5, 5); - + string classify; if (input >= 0) { diff --git a/docs/csharp/language-reference/operators/snippets/DelegateOperator.cs b/docs/csharp/language-reference/operators/snippets/DelegateOperator.cs index 429acd6950ce9..95d1396f5e0bd 100644 --- a/docs/csharp/language-reference/operators/snippets/DelegateOperator.cs +++ b/docs/csharp/language-reference/operators/snippets/DelegateOperator.cs @@ -33,7 +33,7 @@ private static void WithoutParameterList() // Action greet = delegate { Console.WriteLine("Hello!"); }; greet(); - + Action introduce = delegate { Console.WriteLine("This is world!"); }; introduce(42, 2.7); diff --git a/docs/csharp/language-reference/operators/snippets/MemberAccessOperators.cs b/docs/csharp/language-reference/operators/snippets/MemberAccessOperators.cs index 818d4f7489246..5b83628347527 100644 --- a/docs/csharp/language-reference/operators/snippets/MemberAccessOperators.cs +++ b/docs/csharp/language-reference/operators/snippets/MemberAccessOperators.cs @@ -140,7 +140,7 @@ private static void IndexFromEnd() var lines = new List { "one", "two", "three", "four" }; string prelast = lines[^2]; Console.WriteLine(prelast); // output: three - + string word = "Twenty"; Index toFirst = ^word.Length; char first = word[toFirst]; diff --git a/docs/csharp/language-reference/operators/snippets/NullCoalescingOperator.cs b/docs/csharp/language-reference/operators/snippets/NullCoalescingOperator.cs index 1a4699f2bf42e..7791d69980847 100644 --- a/docs/csharp/language-reference/operators/snippets/NullCoalescingOperator.cs +++ b/docs/csharp/language-reference/operators/snippets/NullCoalescingOperator.cs @@ -60,7 +60,7 @@ private static void NullCoalescingAssignment() // List numbers = null; int? a = null; - + (numbers ??= new List()).Add(5); Console.WriteLine(string.Join(" ", numbers)); // output: 5 diff --git a/docs/csharp/language-reference/operators/snippets/PointerOperators.cs b/docs/csharp/language-reference/operators/snippets/PointerOperators.cs index ffdeb5dc28460..12ea9bb16c2c2 100644 --- a/docs/csharp/language-reference/operators/snippets/PointerOperators.cs +++ b/docs/csharp/language-reference/operators/snippets/PointerOperators.cs @@ -40,7 +40,7 @@ private static void AddressOfFixed() byte[] bytes = { 1, 2, 3 }; fixed (byte* pointerToFirst = &bytes[0]) { - // The address stored in pointerToFirst + // The address stored in pointerToFirst // is valid only inside this fixed statement block. } } diff --git a/docs/csharp/language-reference/operators/snippets/SubtractionOperator.cs b/docs/csharp/language-reference/operators/snippets/SubtractionOperator.cs index e02859ebd1b51..2a8bca612cb45 100644 --- a/docs/csharp/language-reference/operators/snippets/SubtractionOperator.cs +++ b/docs/csharp/language-reference/operators/snippets/SubtractionOperator.cs @@ -40,7 +40,7 @@ private static void DelegateRemovalNoChange() var abbaab = a + b + b + a + a + b; var aba = a + b + a; - + var first = abbaab - aba; first(); // output: abbaab Console.WriteLine(); diff --git a/docs/csharp/language-reference/operators/snippets/SwitchExpressions.cs b/docs/csharp/language-reference/operators/snippets/SwitchExpressions.cs index 59c020b288e22..20e70a6b885fe 100644 --- a/docs/csharp/language-reference/operators/snippets/SwitchExpressions.cs +++ b/docs/csharp/language-reference/operators/snippets/SwitchExpressions.cs @@ -23,7 +23,7 @@ public enum Orientation East, West } - + public static void Main() { var direction = Directions.Right; @@ -123,9 +123,9 @@ public static T ExhaustiveExample(IEnumerable sequence) => System.Array { Length : 1} array => (T)array.GetValue(0), System.Array { Length : 2} array => (T)array.GetValue(1), System.Array array => (T)array.GetValue(2), - IEnumerable list + IEnumerable list when !list.Any() => default(T), - IEnumerable list + IEnumerable list when list.Count() < 3 => list.Last(), IList list => list[2], null => throw new ArgumentNullException(nameof(sequence)), diff --git a/docs/csharp/language-reference/operators/snippets/TypeTestingAndConversionOperators.cs b/docs/csharp/language-reference/operators/snippets/TypeTestingAndConversionOperators.cs index 3c630b0efd2ea..01568aaf7a297 100644 --- a/docs/csharp/language-reference/operators/snippets/TypeTestingAndConversionOperators.cs +++ b/docs/csharp/language-reference/operators/snippets/TypeTestingAndConversionOperators.cs @@ -56,7 +56,7 @@ private static void IsOperatorWithInt() // int i = 27; Console.WriteLine(i is System.IFormattable); // output: True - + object iBoxed = i; Console.WriteLine(iBoxed is int); // output: True Console.WriteLine(iBoxed is long); // output: False diff --git a/docs/csharp/language-reference/operators/snippets/UserDefinedConversions.cs b/docs/csharp/language-reference/operators/snippets/UserDefinedConversions.cs index 4bac99f59a32b..c5bf1c361fdac 100644 --- a/docs/csharp/language-reference/operators/snippets/UserDefinedConversions.cs +++ b/docs/csharp/language-reference/operators/snippets/UserDefinedConversions.cs @@ -24,7 +24,7 @@ public static class UserDefinedConversions public static void Main() { var d = new Digit(7); - + byte number = d; Console.WriteLine(number); // output: 7 diff --git a/docs/csharp/programming-guide/concepts/async/snippets/AsyncStreams.cs b/docs/csharp/programming-guide/concepts/async/snippets/AsyncStreams.cs index 911544d0496aa..c702470555d31 100644 --- a/docs/csharp/programming-guide/concepts/async/snippets/AsyncStreams.cs +++ b/docs/csharp/programming-guide/concepts/async/snippets/AsyncStreams.cs @@ -5,7 +5,7 @@ namespace AsyncExamples { - + public static class AsyncStreamExample { @@ -17,7 +17,7 @@ public static async Task Examples() // private static async IAsyncEnumerable ReadWordsFromStream() - { + { string data = @"This is a line of text. Here is the second line of text. diff --git a/docs/csharp/programming-guide/concepts/async/snippets/async-returns1.cs b/docs/csharp/programming-guide/concepts/async/snippets/async-returns1.cs index 14b25ee018cd0..a25758daa36ce 100644 --- a/docs/csharp/programming-guide/concepts/async/snippets/async-returns1.cs +++ b/docs/csharp/programming-guide/concepts/async/snippets/async-returns1.cs @@ -15,10 +15,10 @@ public static async Task ShowTodaysInfo() static async Task GetLeisureHours() { - // Task.FromResult is a placeholder for actual work that returns a string. + // Task.FromResult is a placeholder for actual work that returns a string. var today = await Task.FromResult(DateTime.Now.DayOfWeek.ToString()); - // The method then can process the result in some way. + // The method then can process the result in some way. int leisureHours; if (today.First() == 'S') leisureHours = 16; diff --git a/docs/csharp/programming-guide/concepts/async/snippets/async-returns1a.cs b/docs/csharp/programming-guide/concepts/async/snippets/async-returns1a.cs index 34e035efc747b..69251a58c180e 100644 --- a/docs/csharp/programming-guide/concepts/async/snippets/async-returns1a.cs +++ b/docs/csharp/programming-guide/concepts/async/snippets/async-returns1a.cs @@ -19,10 +19,10 @@ public static async Task ShowTodaysInfo() static async Task GetLeisureHours() { - // Task.FromResult is a placeholder for actual work that returns a string. + // Task.FromResult is a placeholder for actual work that returns a string. var today = await Task.FromResult(DateTime.Now.DayOfWeek.ToString()); - // The method then can process the result in some way. + // The method then can process the result in some way. int leisureHours; if (today.First() == 'S') leisureHours = 16; diff --git a/docs/csharp/programming-guide/concepts/async/snippets/async-returns2.cs b/docs/csharp/programming-guide/concepts/async/snippets/async-returns2.cs index 2fa493a2cc9ca..bfa387f20eb74 100644 --- a/docs/csharp/programming-guide/concepts/async/snippets/async-returns2.cs +++ b/docs/csharp/programming-guide/concepts/async/snippets/async-returns2.cs @@ -14,14 +14,14 @@ public static async Task DisplayCurrentInfo() static async Task WaitAndApologize() { - // Task.Delay is a placeholder for actual work. + // Task.Delay is a placeholder for actual work. await Task.Delay(2000); - // Task.Delay delays the following line by two seconds. + // Task.Delay delays the following line by two seconds. Console.WriteLine("\nSorry for the delay. . . .\n"); } // The example displays the following output: // Sorry for the delay. . . . - // + // // Today is Wednesday, May 24, 2017 // The current time is 15:25:16.2935649 // The current temperature is 76 degrees. diff --git a/docs/csharp/programming-guide/concepts/async/snippets/async-returns2a.cs b/docs/csharp/programming-guide/concepts/async/snippets/async-returns2a.cs index 5a13169d886b9..62f4b9caffbe7 100644 --- a/docs/csharp/programming-guide/concepts/async/snippets/async-returns2a.cs +++ b/docs/csharp/programming-guide/concepts/async/snippets/async-returns2a.cs @@ -18,15 +18,15 @@ public static async Task DisplayCurrentInfo() static async Task WaitAndApologize() { - // Task.Delay is a placeholder for actual work. + // Task.Delay is a placeholder for actual work. await Task.Delay(2000); - // Task.Delay delays the following line by two seconds. + // Task.Delay delays the following line by two seconds. Console.WriteLine("\nSorry for the delay. . . .\n"); } } // The example displays the following output: // Sorry for the delay. . . . -// +// // Today is Wednesday, May 24, 2017 // The current time is 15:25:16.2935649 // The current temperature is 76 degrees. diff --git a/docs/csharp/programming-guide/concepts/async/snippets/async-valuetask.cs b/docs/csharp/programming-guide/concepts/async/snippets/async-valuetask.cs index 33799dae4a29d..d83b7ce6ae757 100644 --- a/docs/csharp/programming-guide/concepts/async/snippets/async-valuetask.cs +++ b/docs/csharp/programming-guide/concepts/async/snippets/async-valuetask.cs @@ -4,29 +4,29 @@ class Program { static Random? rnd; - + static void Main() { Console.WriteLine($"You rolled {GetDiceRoll().Result}"); } - + private static async ValueTask GetDiceRoll() { Console.WriteLine("...Shaking the dice..."); int roll1 = await Roll(); int roll2 = await Roll(); - return roll1 + roll2; - } - + return roll1 + roll2; + } + private static async ValueTask Roll() { if (rnd == null) rnd = new Random(); - + await Task.Delay(500); int diceRoll = rnd.Next(1, 7); return diceRoll; - } + } } // The example displays output like the following: // ...Shaking the dice... diff --git a/docs/standard/assembly/snippets/inspect-contents-using-metadataloadcontext/MetadataLoadContextSnippets.cs b/docs/standard/assembly/snippets/inspect-contents-using-metadataloadcontext/MetadataLoadContextSnippets.cs index 458227cf57aec..1a7a5389873f4 100644 --- a/docs/standard/assembly/snippets/inspect-contents-using-metadataloadcontext/MetadataLoadContextSnippets.cs +++ b/docs/standard/assembly/snippets/inspect-contents-using-metadataloadcontext/MetadataLoadContextSnippets.cs @@ -16,10 +16,10 @@ public static void SnippetsResolver() } public static void SnippetsMetadataLoadContext() - { + { // // Get the array of runtime assemblies. - string[] runtimeAssemblies = Directory.GetFiles(RuntimeEnvironment.GetRuntimeDirectory(), "*.dll"); + string[] runtimeAssemblies = Directory.GetFiles(RuntimeEnvironment.GetRuntimeDirectory(), "*.dll"); // Create the list of assembly paths consisting of runtime assemblies and the inspected assembly. var paths = new List(runtimeAssemblies); diff --git a/samples/snippets/core/system-text-json/csharp/DateTimeOffsetNullHandlingConverter.cs b/samples/snippets/core/system-text-json/csharp/DateTimeOffsetNullHandlingConverter.cs index 0c3f7dbfc3bdf..cce4948d11acc 100644 --- a/samples/snippets/core/system-text-json/csharp/DateTimeOffsetNullHandlingConverter.cs +++ b/samples/snippets/core/system-text-json/csharp/DateTimeOffsetNullHandlingConverter.cs @@ -6,11 +6,11 @@ namespace SystemTextJsonSamples { public class DateTimeOffsetNullHandlingConverter : JsonConverter - + { public override DateTimeOffset Read( - ref Utf8JsonReader reader, - Type typeToConvert, + ref Utf8JsonReader reader, + Type typeToConvert, JsonSerializerOptions options) { if (reader.TokenType == JsonTokenType.Null) @@ -21,8 +21,8 @@ public override DateTimeOffset Read( } public override void Write( - Utf8JsonWriter writer, - DateTimeOffset dateTimeValue, + Utf8JsonWriter writer, + DateTimeOffset dateTimeValue, JsonSerializerOptions options) { writer.WriteStringValue(dateTimeValue); diff --git a/samples/snippets/core/system-text-json/csharp/DeserializeCaseInsensitive.cs b/samples/snippets/core/system-text-json/csharp/DeserializeCaseInsensitive.cs index 59d1e82a4b861..0525381408569 100644 --- a/samples/snippets/core/system-text-json/csharp/DeserializeCaseInsensitive.cs +++ b/samples/snippets/core/system-text-json/csharp/DeserializeCaseInsensitive.cs @@ -14,7 +14,7 @@ public static void Run() ""summary"": ""Hot"" }"; Console.WriteLine($"JSON input:\n{jsonString}\n"); - + // var options = new JsonSerializerOptions { diff --git a/samples/snippets/core/system-text-json/csharp/DeserializeIgnoreNull.cs b/samples/snippets/core/system-text-json/csharp/DeserializeIgnoreNull.cs index 64b751726ada7..839d96ba6f916 100644 --- a/samples/snippets/core/system-text-json/csharp/DeserializeIgnoreNull.cs +++ b/samples/snippets/core/system-text-json/csharp/DeserializeIgnoreNull.cs @@ -14,7 +14,7 @@ public static void Run() ""Summary"": null }"; Console.WriteLine($"JSON input:\n{jsonString}\n"); - + // Deserialize default behavior var weatherForecast = JsonSerializer.Deserialize(jsonString); weatherForecast.DisplayPropertyValues(); diff --git a/samples/snippets/core/system-text-json/csharp/DictionaryTKeyEnumTValueConverter.cs b/samples/snippets/core/system-text-json/csharp/DictionaryTKeyEnumTValueConverter.cs index abf9b738647ca..4550979262754 100644 --- a/samples/snippets/core/system-text-json/csharp/DictionaryTKeyEnumTValueConverter.cs +++ b/samples/snippets/core/system-text-json/csharp/DictionaryTKeyEnumTValueConverter.cs @@ -24,7 +24,7 @@ public override bool CanConvert(Type typeToConvert) } public override JsonConverter CreateConverter( - Type type, + Type type, JsonSerializerOptions options) { Type keyType = type.GetGenericArguments()[0]; @@ -41,7 +41,7 @@ public override JsonConverter CreateConverter( return converter; } - private class DictionaryEnumConverterInner : + private class DictionaryEnumConverterInner : JsonConverter> where TKey : struct, Enum { private readonly JsonConverter _valueConverter; @@ -60,8 +60,8 @@ public DictionaryEnumConverterInner(JsonSerializerOptions options) } public override Dictionary Read( - ref Utf8JsonReader reader, - Type typeToConvert, + ref Utf8JsonReader reader, + Type typeToConvert, JsonSerializerOptions options) { if (reader.TokenType != JsonTokenType.StartObject) @@ -114,8 +114,8 @@ public override Dictionary Read( } public override void Write( - Utf8JsonWriter writer, - Dictionary dictionary, + Utf8JsonWriter writer, + Dictionary dictionary, JsonSerializerOptions options) { writer.WriteStartObject(); diff --git a/samples/snippets/core/system-text-json/csharp/SerializeCamelCaseDictionaryKeys.cs b/samples/snippets/core/system-text-json/csharp/SerializeCamelCaseDictionaryKeys.cs index 886291e2b4bfd..2eca3cc68f98c 100644 --- a/samples/snippets/core/system-text-json/csharp/SerializeCamelCaseDictionaryKeys.cs +++ b/samples/snippets/core/system-text-json/csharp/SerializeCamelCaseDictionaryKeys.cs @@ -11,7 +11,7 @@ public static void Run() string jsonString; WeatherForecastWithDictionary weatherForecast = WeatherForecastFactories.CreateWeatherForecastWithDictionary(); weatherForecast.DisplayPropertyValues(); - + // var options = new JsonSerializerOptions { diff --git a/samples/snippets/core/system-text-json/csharp/Temperature.cs b/samples/snippets/core/system-text-json/csharp/Temperature.cs index 044694b06abb8..681b03d22fd06 100644 --- a/samples/snippets/core/system-text-json/csharp/Temperature.cs +++ b/samples/snippets/core/system-text-json/csharp/Temperature.cs @@ -13,7 +13,7 @@ public Temperature(int degrees, bool celsius) private bool _isCelsius; private int _degrees; public int Degrees => _degrees; - public bool IsCelsius => _isCelsius; + public bool IsCelsius => _isCelsius; public bool IsFahrenheit => !_isCelsius; public override string ToString() => $"{_degrees.ToString()}{(_isCelsius ? "C" : "F")}"; diff --git a/samples/snippets/core/system-text-json/csharp/WeatherForecastRuntimeIgnoreConverter.cs b/samples/snippets/core/system-text-json/csharp/WeatherForecastRuntimeIgnoreConverter.cs index 12c47a5038013..ccb5b1b6ecdfc 100644 --- a/samples/snippets/core/system-text-json/csharp/WeatherForecastRuntimeIgnoreConverter.cs +++ b/samples/snippets/core/system-text-json/csharp/WeatherForecastRuntimeIgnoreConverter.cs @@ -7,8 +7,8 @@ namespace SystemTextJsonSamples public class WeatherForecastRuntimeIgnoreConverter : JsonConverter { public override WeatherForecast Read( - ref Utf8JsonReader reader, - Type typeToConvert, + ref Utf8JsonReader reader, + Type typeToConvert, JsonSerializerOptions options) { if (reader.TokenType != JsonTokenType.StartObject) diff --git a/samples/snippets/core/whats-new/whats-new-in-21/csharp/brotli.cs b/samples/snippets/core/whats-new/whats-new-in-21/csharp/brotli.cs index cafaf39bbc854..5c8e85048fc3c 100644 --- a/samples/snippets/core/whats-new/whats-new-in-21/csharp/brotli.cs +++ b/samples/snippets/core/whats-new/whats-new-in-21/csharp/brotli.cs @@ -5,7 +5,7 @@ public static class BrotliExample { // - public static Stream DecompressWithBrotli(Stream toDecompress) + public static Stream DecompressWithBrotli(Stream toDecompress) { MemoryStream decompressedStream = new MemoryStream(); using (BrotliStream decompressionStream = new BrotliStream(toDecompress, CompressionMode.Decompress)) diff --git a/samples/snippets/core/whats-new/whats-new-in-30/cs/JSON.cs b/samples/snippets/core/whats-new/whats-new-in-30/cs/JSON.cs index 33b74c28d2975..46b555cd254f4 100644 --- a/samples/snippets/core/whats-new/whats-new-in-30/cs/JSON.cs +++ b/samples/snippets/core/whats-new/whats-new-in-30/cs/JSON.cs @@ -15,7 +15,7 @@ public string WriteJSON() LastName = "Smith", Age = 18 }; - + System.Console.WriteLine(System.Text.Json.JsonSerializer.Serialize(instance)); // diff --git a/samples/snippets/core/whats-new/whats-new-in-30/cs/Program.cs b/samples/snippets/core/whats-new/whats-new-in-30/cs/Program.cs index 600ba074a62bd..7b63bfe988c5e 100644 --- a/samples/snippets/core/whats-new/whats-new-in-30/cs/Program.cs +++ b/samples/snippets/core/whats-new/whats-new-in-30/cs/Program.cs @@ -7,7 +7,7 @@ namespace whats_new { class Program { - + static async Task Main(string[] args) { // @@ -44,7 +44,7 @@ static async Task Main(string[] args) public static void PrintJson(ReadOnlySpan dataUtf8) { var json = new Utf8JsonReader(dataUtf8, isFinalBlock: true, state: default); - + while (json.Read()) { JsonTokenType tokenType = json.TokenType; diff --git a/samples/snippets/core/whats-new/whats-new-in-30/cs/TLS.cs b/samples/snippets/core/whats-new/whats-new-in-30/cs/TLS.cs index 90c2da7686adf..0aec8158271ca 100644 --- a/samples/snippets/core/whats-new/whats-new-in-30/cs/TLS.cs +++ b/samples/snippets/core/whats-new/whats-new-in-30/cs/TLS.cs @@ -17,7 +17,7 @@ public static async Task ConnectCloudFlare() await tcpClient.ConnectAsync(targetHost, 443); using SslStream sslStream = new SslStream(tcpClient.GetStream()); - + await sslStream.AuthenticateAsClientAsync(targetHost); await Console.Out.WriteLineAsync($"Connected to {targetHost} with {sslStream.SslProtocol}"); } diff --git a/samples/snippets/cpp/VS_Snippets_Misc/astoria reflection provider/customdataserviceclient/program.cs b/samples/snippets/cpp/VS_Snippets_Misc/astoria reflection provider/customdataserviceclient/program.cs index 2ba2c65345ed3..425d6631cd9d7 100644 --- a/samples/snippets/cpp/VS_Snippets_Misc/astoria reflection provider/customdataserviceclient/program.cs +++ b/samples/snippets/cpp/VS_Snippets_Misc/astoria reflection provider/customdataserviceclient/program.cs @@ -17,7 +17,7 @@ static void Main(string[] args) Order selectedOrder = GetOrderWithItems(context); PrintItems(selectedOrder); - + Item selectedItem = selectedOrder.Items.FirstOrDefault(); selectedItem.Quantity += 1; context.UpdateObject(selectedItem); @@ -40,7 +40,7 @@ static void Main(string[] args) PrintItems(selectedOrder); } static Order GetOrderWithItems(OrderItemData context) - { + { var selectedOrder = (from orders in context.Orders.Expand("Items") select orders).FirstOrDefault(); return selectedOrder; diff --git a/samples/snippets/cpp/VS_Snippets_Remoting/ChannelServices_GetChannel/CPP/ChannelServices_GetChannel_Share.cs b/samples/snippets/cpp/VS_Snippets_Remoting/ChannelServices_GetChannel/CPP/ChannelServices_GetChannel_Share.cs index 587e5b8cb8f16..c589c19b77da7 100644 --- a/samples/snippets/cpp/VS_Snippets_Remoting/ChannelServices_GetChannel/CPP/ChannelServices_GetChannel_Share.cs +++ b/samples/snippets/cpp/VS_Snippets_Remoting/ChannelServices_GetChannel/CPP/ChannelServices_GetChannel_Share.cs @@ -1,9 +1,9 @@ /* This program implments the remote method which will be called by the - client. + client. */ using System; -namespace RemotingSamples +namespace RemotingSamples { public class HelloServer : MarshalByRefObject { diff --git a/samples/snippets/cpp/VS_Snippets_Remoting/ChannelServices_SyncDispatchMessage/CPP/ChannelServices_SyncDispatchMessage_share.cs b/samples/snippets/cpp/VS_Snippets_Remoting/ChannelServices_SyncDispatchMessage/CPP/ChannelServices_SyncDispatchMessage_share.cs index b231ab1714221..997024604bf93 100644 --- a/samples/snippets/cpp/VS_Snippets_Remoting/ChannelServices_SyncDispatchMessage/CPP/ChannelServices_SyncDispatchMessage_share.cs +++ b/samples/snippets/cpp/VS_Snippets_Remoting/ChannelServices_SyncDispatchMessage/CPP/ChannelServices_SyncDispatchMessage_share.cs @@ -1,6 +1,6 @@ /* - The class 'PrintServer' is derived from 'MarshalByRefObject' to - make it remotable. + The class 'PrintServer' is derived from 'MarshalByRefObject' to + make it remotable. */ using System; using System.Runtime.Remoting; @@ -8,7 +8,7 @@ public class PrintServer : MarshalByRefObject { public int MyPrintMethod(String myString, double fValue, int iValue) { - Console.WriteLine("PrintServer.MyPrintMethod {0} {1} {2}", + Console.WriteLine("PrintServer.MyPrintMethod {0} {1} {2}", myString, fValue, iValue); return iValue; } diff --git a/samples/snippets/cpp/VS_Snippets_Remoting/IChannelSender/CPP/IChannelSender_Share.cs b/samples/snippets/cpp/VS_Snippets_Remoting/IChannelSender/CPP/IChannelSender_Share.cs index 80c339873711c..adb3c9e61daae 100644 --- a/samples/snippets/cpp/VS_Snippets_Remoting/IChannelSender/CPP/IChannelSender_Share.cs +++ b/samples/snippets/cpp/VS_Snippets_Remoting/IChannelSender/CPP/IChannelSender_Share.cs @@ -4,14 +4,14 @@ define the methods to execute from the client. */ using System; -public class MyHelloServer : MarshalByRefObject +public class MyHelloServer : MarshalByRefObject { - public MyHelloServer() + public MyHelloServer() { Console.WriteLine("HelloServer activated"); } - public String myHelloMethod(String myString) + public String myHelloMethod(String myString) { Console.WriteLine("Hello.HelloMethod : {0}", myString); return "Hi there " + myString; diff --git a/samples/snippets/cpp/VS_Snippets_Wpf/System.Windows.Interop.D3DImage/cpp/window1.xaml.cs b/samples/snippets/cpp/VS_Snippets_Wpf/System.Windows.Interop.D3DImage/cpp/window1.xaml.cs index edf9af17922ee..38f3021fbe554 100644 --- a/samples/snippets/cpp/VS_Snippets_Wpf/System.Windows.Interop.D3DImage/cpp/window1.xaml.cs +++ b/samples/snippets/cpp/VS_Snippets_Wpf/System.Windows.Interop.D3DImage/cpp/window1.xaml.cs @@ -29,22 +29,22 @@ public MainWindow() HRESULT.Check(SetAlpha(false)); HRESULT.Check(SetNumDesiredSamples(4)); - // + // // Optional: Subscribing to the IsFrontBufferAvailableChanged event. // - // If you don't render every frame (e.g. you only render in + // If you don't render every frame (e.g. you only render in // reaction to a button click), you should subscribe to the - // IsFrontBufferAvailableChanged event to be notified when rendered content - // is no longer being displayed. This event also notifies you when - // the D3DImage is capable of being displayed again. - - // For example, in the button click case, if you don't render again when - // the IsFrontBufferAvailable property is set to true, your + // IsFrontBufferAvailableChanged event to be notified when rendered content + // is no longer being displayed. This event also notifies you when + // the D3DImage is capable of being displayed again. + + // For example, in the button click case, if you don't render again when + // the IsFrontBufferAvailable property is set to true, your // D3DImage won't display anything until the next button click. // // Because this application renders every frame, there is no need to // handle the IsFrontBufferAvailableChanged event. - // + // CompositionTarget.Rendering += new EventHandler(CompositionTarget_Rendering); // @@ -53,11 +53,11 @@ public MainWindow() // The surface is created initially on a particular adapter. // If the WPF window is dragged to another adapter, WPF // ensures that the D3DImage still shows up on the new - // adapter. + // adapter. // // This process is slow on Windows XP. // - // Performance is better on Vista with a 9Ex device. It's only + // Performance is better on Vista with a 9Ex device. It's only // slow when the D3DImage crosses a video-card boundary. // // To work around this issue, you can move your surface when @@ -66,7 +66,7 @@ public MainWindow() // D3DImage into screen space and find out which adapter // contains that screen space point. // - // When your D3DImage straddles two adapters, nothing + // When your D3DImage straddles two adapters, nothing // can be done, because one will be updating slowly. // _adapterTimer = new DispatcherTimer(); @@ -77,11 +77,11 @@ public MainWindow() // // Optional: Surface resizing // - // The D3DImage is scaled when WPF renders it at a size + // The D3DImage is scaled when WPF renders it at a size // different from the natural size of the surface. If the - // D3DImage is scaled up significantly, image quality - // degrades. - // + // D3DImage is scaled up significantly, image quality + // degrades. + // // To avoid this, you can either create a very large // texture initially, or you can create new surfaces as // the size changes. Below is a very simple example of @@ -91,19 +91,19 @@ public MainWindow() // that new surfaces are created while the element // is still being arranged. A 200 ms interval gives // a good balance between image quality and performance. - // You must be careful not to create new surfaces too - // frequently. Frequently allocating a new surface may - // fragment or exhaust video memory. This issue is more - // significant on XDDM than it is on WDDM, because WDDM + // You must be careful not to create new surfaces too + // frequently. Frequently allocating a new surface may + // fragment or exhaust video memory. This issue is more + // significant on XDDM than it is on WDDM, because WDDM // can page out video memory. // - // Another approach is deriving from the Image class, + // Another approach is deriving from the Image class, // participating in layout by overriding the ArrangeOverride method, and // updating size in the overriden method. Performance will degrade // if you resize too frequently. // - // Blurry D3DImages can still occur due to subpixel - // alignments. + // Blurry D3DImages can still occur due to subpixel + // alignments. // _sizeTimer = new DispatcherTimer(DispatcherPriority.Render); _sizeTimer.Tick += new EventHandler(SizeTimer_Tick); @@ -126,12 +126,12 @@ void AdapterTimer_Tick(object sender, EventArgs e) void SizeTimer_Tick(object sender, EventArgs e) { // The following code does not account for RenderTransforms. - // To handle that case, you must transform up to the root and + // To handle that case, you must transform up to the root and // check the size there. - // Given that the D3DImage is at 96.0 DPI, its Width and Height - // properties will always be integers. ActualWidth/Height - // may not be integers, so they are cast to integers. + // Given that the D3DImage is at 96.0 DPI, its Width and Height + // properties will always be integers. ActualWidth/Height + // may not be integers, so they are cast to integers. uint actualWidth = (uint)imgelt.ActualWidth; uint actualHeight = (uint)imgelt.ActualHeight; if ((actualWidth > 0 && actualHeight > 0) && @@ -145,7 +145,7 @@ void CompositionTarget_Rendering(object sender, EventArgs e) { RenderingEventArgs args = (RenderingEventArgs)e; - // It's possible for Rendering to call back twice in the same frame + // It's possible for Rendering to call back twice in the same frame // so only render when we haven't already rendered in this frame. if (d3dimg.IsFrontBufferAvailable && _lastRender != args.RenderingTime) { @@ -153,9 +153,9 @@ void CompositionTarget_Rendering(object sender, EventArgs e) HRESULT.Check(GetBackBufferNoRef(out pSurface)); if (pSurface != IntPtr.Zero) { - + d3dimg.Lock(); - // Repeatedly calling SetBackBuffer with the same IntPtr is + // Repeatedly calling SetBackBuffer with the same IntPtr is // a no-op. There is no performance penalty. d3dimg.SetBackBuffer(D3DResourceType.IDirect3DSurface9, pSurface); HRESULT.Check(Render()); diff --git a/samples/snippets/csharp/PatternMatching/GeometricUtilities.cs b/samples/snippets/csharp/PatternMatching/GeometricUtilities.cs index 920853f7f81d9..7a8c492f11579 100644 --- a/samples/snippets/csharp/PatternMatching/GeometricUtilities.cs +++ b/samples/snippets/csharp/PatternMatching/GeometricUtilities.cs @@ -33,7 +33,7 @@ public static double ComputeArea(object shape) { var s = (Square)shape; return s.Side * s.Side; - } + } else if (shape is Circle) { var c = (Circle)shape; diff --git a/samples/snippets/csharp/PatternMatching/Program.cs b/samples/snippets/csharp/PatternMatching/Program.cs index c297efc7261de..49033bca1d44a 100644 --- a/samples/snippets/csharp/PatternMatching/Program.cs +++ b/samples/snippets/csharp/PatternMatching/Program.cs @@ -22,7 +22,7 @@ static void Main(string[] args) WriteLine(GeometricUtilities.ComputeArea_Version3(s)); WriteLine(GeometricUtilities.ComputeArea_Version3(c)); - + var what = CreateShape(" "); WriteLine(what); @@ -40,7 +40,7 @@ static object CreateShape(string shapeDescription) case "square": return new Square(4); - + case "large-circle": return new Circle(12); @@ -49,7 +49,7 @@ static object CreateShape(string shapeDescription) return null; default: return "invalid shape description"; - } + } } #endregion } diff --git a/samples/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlDataAdapter.SqlDataAdapter Example/CS/source.cs b/samples/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlDataAdapter.SqlDataAdapter Example/CS/source.cs index b86f0c7119d58..957a742f0b0f2 100644 --- a/samples/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlDataAdapter.SqlDataAdapter Example/CS/source.cs +++ b/samples/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData SqlDataAdapter.SqlDataAdapter Example/CS/source.cs @@ -26,21 +26,21 @@ public static SqlDataAdapter CreateSqlDataAdapter(SqlConnection connection) "DELETE FROM Customers WHERE CustomerID = @CustomerID", connection); // Create the parameters. - adapter.InsertCommand.Parameters.Add("@CustomerID", + adapter.InsertCommand.Parameters.Add("@CustomerID", SqlDbType.Char, 5, "CustomerID"); - adapter.InsertCommand.Parameters.Add("@CompanyName", + adapter.InsertCommand.Parameters.Add("@CompanyName", SqlDbType.VarChar, 40, "CompanyName"); - adapter.UpdateCommand.Parameters.Add("@CustomerID", + adapter.UpdateCommand.Parameters.Add("@CustomerID", SqlDbType.Char, 5, "CustomerID"); - adapter.UpdateCommand.Parameters.Add("@CompanyName", + adapter.UpdateCommand.Parameters.Add("@CompanyName", SqlDbType.VarChar, 40, "CompanyName"); - adapter.UpdateCommand.Parameters.Add("@oldCustomerID", - SqlDbType.Char, 5, "CustomerID").SourceVersion = + adapter.UpdateCommand.Parameters.Add("@oldCustomerID", + SqlDbType.Char, 5, "CustomerID").SourceVersion = DataRowVersion.Original; - adapter.DeleteCommand.Parameters.Add("@CustomerID", - SqlDbType.Char, 5, "CustomerID").SourceVersion = + adapter.DeleteCommand.Parameters.Add("@CustomerID", + SqlDbType.Char, 5, "CustomerID").SourceVersion = DataRowVersion.Original; return adapter; diff --git a/samples/snippets/csharp/VS_Snippets_ADO.NET/DP Custom CopyToDataTable Examples/CS/Program.cs b/samples/snippets/csharp/VS_Snippets_ADO.NET/DP Custom CopyToDataTable Examples/CS/Program.cs index 4edef8dac6180..fe566c9f4e7e2 100644 --- a/samples/snippets/csharp/VS_Snippets_ADO.NET/DP Custom CopyToDataTable Examples/CS/Program.cs +++ b/samples/snippets/csharp/VS_Snippets_ADO.NET/DP Custom CopyToDataTable Examples/CS/Program.cs @@ -56,18 +56,18 @@ where order.Field("OnlineOrderFlag") == true detail.Field("ProductID") }; - DataTable orderTable = query.CopyToDataTable(); - // + DataTable orderTable = query.CopyToDataTable(); + // - DisplayTable(orderTable); + DisplayTable(orderTable); } static void LoadItemsIntoTable() { // - // Create a sequence. - Item[] items = new Item[] - { new Book{Id = 1, Price = 13.50, Genre = "Comedy", Author = "Gustavo Achong"}, + // Create a sequence. + Item[] items = new Item[] + { new Book{Id = 1, Price = 13.50, Genre = "Comedy", Author = "Gustavo Achong"}, new Book{Id = 2, Price = 8.50, Genre = "Drama", Author = "Jessie Zeng"}, new Movie{Id = 1, Price = 22.99, Genre = "Comedy", Director = "Marissa Barnes"}, new Movie{Id = 1, Price = 13.40, Genre = "Action", Director = "Emmanuel Fernandez"}}; @@ -87,14 +87,14 @@ orderby i.Price static void LoadItemsIntoExistingTable() { // - // Create a sequence. - Item[] items = new Item[] - { new Book{Id = 1, Price = 13.50, Genre = "Comedy", Author = "Gustavo Achong"}, + // Create a sequence. + Item[] items = new Item[] + { new Book{Id = 1, Price = 13.50, Genre = "Comedy", Author = "Gustavo Achong"}, new Book{Id = 2, Price = 8.50, Genre = "Drama", Author = "Jessie Zeng"}, new Movie{Id = 1, Price = 22.99, Genre = "Comedy", Director = "Marissa Barnes"}, new Movie{Id = 1, Price = 13.40, Genre = "Action", Director = "Emmanuel Fernandez"}}; - // Create a table with a schema that matches that of the query results. + // Create a table with a schema that matches that of the query results. DataTable table = new DataTable(); table.Columns.Add("Price", typeof(int)); table.Columns.Add("Genre", typeof(string)); @@ -112,13 +112,13 @@ orderby i.Price static void LoadItemsExpandSchema() { // - // Create a sequence. - Item[] items = new Item[] - { new Book{Id = 1, Price = 13.50, Genre = "Comedy", Author = "Gustavo Achong"}, + // Create a sequence. + Item[] items = new Item[] + { new Book{Id = 1, Price = 13.50, Genre = "Comedy", Author = "Gustavo Achong"}, new Book{Id = 2, Price = 8.50, Genre = "Drama", Author = "Jessie Zeng"}, new Movie{Id = 1, Price = 22.99, Genre = "Comedy", Director = "Marissa Barnes"}, new Movie{Id = 1, Price = 13.40, Genre = "Action", Director = "Emmanuel Fernandez"}}; - + // Load into an existing DataTable, expand the schema and // autogenerate a new Id. DataTable table = new DataTable(); @@ -139,13 +139,13 @@ orderby i.Price static void LoadScalarSequence() { // - // Create a sequence. - Item[] items = new Item[] - { new Book{Id = 1, Price = 13.50, Genre = "Comedy", Author = "Gustavo Achong"}, + // Create a sequence. + Item[] items = new Item[] + { new Book{Id = 1, Price = 13.50, Genre = "Comedy", Author = "Gustavo Achong"}, new Book{Id = 2, Price = 8.50, Genre = "Drama", Author = "Jessie Zeng"}, new Movie{Id = 1, Price = 22.99, Genre = "Comedy", Director = "Marissa Barnes"}, new Movie{Id = 1, Price = 13.40, Genre = "Action", Director = "Emmanuel Fernandez"}}; - + // load sequence of scalars. IEnumerable query = from i in items where i.Price > 9.99 @@ -175,8 +175,8 @@ static void FillDataSet(DataSet ds) // try { - // Create a new adapter and give it a query to fetch sales order, contact, - // address, and product information for sales in the year 2002. Point connection + // Create a new adapter and give it a query to fetch sales order, contact, + // address, and product information for sales in the year 2002. Point connection // information to the configuration setting "AdventureWorks". string connectionString = "Data Source=localhost;Initial Catalog=AdventureWorks;" + "Integrated Security=true;"; @@ -302,10 +302,10 @@ public ObjectShredder() /// Loads a DataTable from a sequence of objects. /// /// The sequence of objects to load into the DataTable. - /// The input table. The schema of the table must match that - /// the type T. If the table is null, a new table is created with a schema + /// The input table. The schema of the table must match that + /// the type T. If the table is null, a new table is created with a schema /// created from the public properties and fields of the type T. - /// Specifies how values from the source sequence will be applied to + /// Specifies how values from the source sequence will be applied to /// existing rows in the table. /// A DataTable created from the source sequence. public DataTable Shred(IEnumerable source, DataTable table, LoadOption? options) @@ -377,7 +377,7 @@ public DataTable ShredPrimitive(IEnumerable source, DataTable table, LoadOpti // Return the table. return table; - } + } public object[] ShredObject(DataTable table, T instance) { @@ -412,8 +412,8 @@ public object[] ShredObject(DataTable table, T instance) public DataTable ExtendTable(DataTable table, Type type) { - // Extend the table schema if the input table was null or if the value - // in the sequence is derived from type T. + // Extend the table schema if the input table was null or if the value + // in the sequence is derived from type T. foreach (FieldInfo f in type.GetFields()) { if (!_ordinalMap.ContainsKey(f.Name)) diff --git a/samples/snippets/csharp/VS_Snippets_ADO.NET/DP DataView Samples/CS/Form1.Designer.cs b/samples/snippets/csharp/VS_Snippets_ADO.NET/DP DataView Samples/CS/Form1.Designer.cs index 1962d99262a81..c27eac134da06 100644 --- a/samples/snippets/csharp/VS_Snippets_ADO.NET/DP DataView Samples/CS/Form1.Designer.cs +++ b/samples/snippets/csharp/VS_Snippets_ADO.NET/DP DataView Samples/CS/Form1.Designer.cs @@ -71,17 +71,17 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.bindingSource1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).BeginInit(); this.SuspendLayout(); - // + // // dataGridView1 - // + // this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dataGridView1.Location = new System.Drawing.Point(13, 13); this.dataGridView1.Name = "dataGridView1"; this.dataGridView1.Size = new System.Drawing.Size(594, 150); this.dataGridView1.TabIndex = 0; - // + // // button1 - // + // this.button1.Location = new System.Drawing.Point(10, 310); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(75, 23); @@ -89,9 +89,9 @@ private void InitializeComponent() this.button1.Text = "button1"; this.button1.UseVisualStyleBackColor = true; this.button1.Click += new System.EventHandler(this.button1_Click); - // + // // button2 - // + // this.button2.Location = new System.Drawing.Point(112, 310); this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(75, 23); @@ -99,9 +99,9 @@ private void InitializeComponent() this.button2.Text = "button2"; this.button2.UseVisualStyleBackColor = true; this.button2.Click += new System.EventHandler(this.button2_Click); - // + // // button3 - // + // this.button3.Location = new System.Drawing.Point(204, 310); this.button3.Name = "button3"; this.button3.Size = new System.Drawing.Size(75, 23); @@ -109,18 +109,18 @@ private void InitializeComponent() this.button3.Text = "button3"; this.button3.UseVisualStyleBackColor = true; this.button3.Click += new System.EventHandler(this.button3_Click); - // + // // label1 - // + // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(10, 288); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(130, 13); this.label1.TabIndex = 4; this.label1.Text = "Create from simple queries"; - // + // // button4 - // + // this.button4.Location = new System.Drawing.Point(296, 310); this.button4.Name = "button4"; this.button4.Size = new System.Drawing.Size(75, 23); @@ -128,9 +128,9 @@ private void InitializeComponent() this.button4.Text = "button4"; this.button4.UseVisualStyleBackColor = true; this.button4.Click += new System.EventHandler(this.button4_Click); - // + // // button5 - // + // this.button5.Location = new System.Drawing.Point(16, 368); this.button5.Name = "button5"; this.button5.Size = new System.Drawing.Size(75, 23); @@ -138,18 +138,18 @@ private void InitializeComponent() this.button5.Text = "button5"; this.button5.UseVisualStyleBackColor = true; this.button5.Click += new System.EventHandler(this.button5_Click); - // + // // label2 - // + // this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(13, 352); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(87, 13); this.label2.TabIndex = 7; this.label2.Text = "Create from table"; - // + // // button6 - // + // this.button6.Location = new System.Drawing.Point(16, 422); this.button6.Name = "button6"; this.button6.Size = new System.Drawing.Size(75, 23); @@ -157,27 +157,27 @@ private void InitializeComponent() this.button6.Text = "button6"; this.button6.UseVisualStyleBackColor = true; this.button6.Click += new System.EventHandler(this.button6_Click); - // + // // label3 - // + // this.label3.AutoSize = true; this.label3.Location = new System.Drawing.Point(13, 406); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(40, 13); this.label3.TabIndex = 9; this.label3.Text = "Sorting"; - // + // // label4 - // + // this.label4.AutoSize = true; this.label4.Location = new System.Drawing.Point(13, 461); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(43, 13); this.label4.TabIndex = 10; this.label4.Text = "Filtering"; - // + // // button7 - // + // this.button7.Location = new System.Drawing.Point(97, 422); this.button7.Name = "button7"; this.button7.Size = new System.Drawing.Size(75, 23); @@ -185,9 +185,9 @@ private void InitializeComponent() this.button7.Text = "button7"; this.button7.UseVisualStyleBackColor = true; this.button7.Click += new System.EventHandler(this.button7_Click); - // + // // button8 - // + // this.button8.Location = new System.Drawing.Point(178, 422); this.button8.Name = "button8"; this.button8.Size = new System.Drawing.Size(75, 23); @@ -195,9 +195,9 @@ private void InitializeComponent() this.button8.Text = "button8"; this.button8.UseVisualStyleBackColor = true; this.button8.Click += new System.EventHandler(this.button8_Click); - // + // // button9 - // + // this.button9.Location = new System.Drawing.Point(259, 422); this.button9.Name = "button9"; this.button9.Size = new System.Drawing.Size(75, 23); @@ -205,9 +205,9 @@ private void InitializeComponent() this.button9.Text = "button9"; this.button9.UseVisualStyleBackColor = true; this.button9.Click += new System.EventHandler(this.button9_Click); - // + // // button10 - // + // this.button10.Location = new System.Drawing.Point(340, 422); this.button10.Name = "button10"; this.button10.Size = new System.Drawing.Size(75, 23); @@ -215,9 +215,9 @@ private void InitializeComponent() this.button10.Text = "button10"; this.button10.UseVisualStyleBackColor = true; this.button10.Click += new System.EventHandler(this.button10_Click); - // + // // button11 - // + // this.button11.Location = new System.Drawing.Point(421, 422); this.button11.Name = "button11"; this.button11.Size = new System.Drawing.Size(75, 23); @@ -225,9 +225,9 @@ private void InitializeComponent() this.button11.Text = "button11"; this.button11.UseVisualStyleBackColor = true; this.button11.Click += new System.EventHandler(this.button11_Click); - // + // // button12 - // + // this.button12.Location = new System.Drawing.Point(502, 422); this.button12.Name = "button12"; this.button12.Size = new System.Drawing.Size(75, 23); @@ -235,9 +235,9 @@ private void InitializeComponent() this.button12.Text = "button12"; this.button12.UseVisualStyleBackColor = true; this.button12.Click += new System.EventHandler(this.button12_Click); - // + // // button13 - // + // this.button13.Location = new System.Drawing.Point(16, 490); this.button13.Name = "button13"; this.button13.Size = new System.Drawing.Size(75, 23); @@ -245,9 +245,9 @@ private void InitializeComponent() this.button13.Text = "button13"; this.button13.UseVisualStyleBackColor = true; this.button13.Click += new System.EventHandler(this.button13_Click); - // + // // button14 - // + // this.button14.Location = new System.Drawing.Point(97, 490); this.button14.Name = "button14"; this.button14.Size = new System.Drawing.Size(75, 23); @@ -255,9 +255,9 @@ private void InitializeComponent() this.button14.Text = "button14"; this.button14.UseVisualStyleBackColor = true; this.button14.Click += new System.EventHandler(this.button14_Click); - // + // // button15 - // + // this.button15.Location = new System.Drawing.Point(178, 490); this.button15.Name = "button15"; this.button15.Size = new System.Drawing.Size(75, 23); @@ -265,9 +265,9 @@ private void InitializeComponent() this.button15.Text = "button15"; this.button15.UseVisualStyleBackColor = true; this.button15.Click += new System.EventHandler(this.button15_Click); - // + // // button16 - // + // this.button16.Location = new System.Drawing.Point(259, 490); this.button16.Name = "button16"; this.button16.Size = new System.Drawing.Size(75, 23); @@ -275,18 +275,18 @@ private void InitializeComponent() this.button16.Text = "button16"; this.button16.UseVisualStyleBackColor = true; this.button16.Click += new System.EventHandler(this.button16_Click); - // + // // label5 - // + // this.label5.AutoSize = true; this.label5.Location = new System.Drawing.Point(16, 529); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(98, 13); this.label5.TabIndex = 21; this.label5.Text = "Filtering and sorting"; - // + // // button17 - // + // this.button17.Location = new System.Drawing.Point(341, 490); this.button17.Name = "button17"; this.button17.Size = new System.Drawing.Size(75, 23); @@ -294,9 +294,9 @@ private void InitializeComponent() this.button17.Text = "button17"; this.button17.UseVisualStyleBackColor = true; this.button17.Click += new System.EventHandler(this.button17_Click); - // + // // button18 - // + // this.button18.Location = new System.Drawing.Point(423, 490); this.button18.Name = "button18"; this.button18.Size = new System.Drawing.Size(75, 23); @@ -304,9 +304,9 @@ private void InitializeComponent() this.button18.Text = "button18"; this.button18.UseVisualStyleBackColor = true; this.button18.Click += new System.EventHandler(this.button18_Click); - // + // // button19 - // + // this.button19.Location = new System.Drawing.Point(19, 559); this.button19.Name = "button19"; this.button19.Size = new System.Drawing.Size(75, 23); @@ -314,9 +314,9 @@ private void InitializeComponent() this.button19.Text = "button19"; this.button19.UseVisualStyleBackColor = true; this.button19.Click += new System.EventHandler(this.button19_Click); - // + // // button20 - // + // this.button20.Location = new System.Drawing.Point(101, 559); this.button20.Name = "button20"; this.button20.Size = new System.Drawing.Size(75, 23); @@ -324,9 +324,9 @@ private void InitializeComponent() this.button20.Text = "button20"; this.button20.UseVisualStyleBackColor = true; this.button20.Click += new System.EventHandler(this.button20_Click); - // + // // button21 - // + // this.button21.Location = new System.Drawing.Point(313, 559); this.button21.Name = "button21"; this.button21.Size = new System.Drawing.Size(75, 23); @@ -334,18 +334,18 @@ private void InitializeComponent() this.button21.Text = "button21"; this.button21.UseVisualStyleBackColor = true; this.button21.Click += new System.EventHandler(this.button21_Click); - // + // // label6 - // + // this.label6.AutoSize = true; this.label6.Location = new System.Drawing.Point(310, 543); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(27, 13); this.label6.TabIndex = 27; this.label6.Text = "Find"; - // + // // button22 - // + // this.button22.Location = new System.Drawing.Point(394, 559); this.button22.Name = "button22"; this.button22.Size = new System.Drawing.Size(75, 23); @@ -353,9 +353,9 @@ private void InitializeComponent() this.button22.Text = "button22"; this.button22.UseVisualStyleBackColor = true; this.button22.Click += new System.EventHandler(this.button22_Click); - // + // // button23 - // + // this.button23.Location = new System.Drawing.Point(505, 490); this.button23.Name = "button23"; this.button23.Size = new System.Drawing.Size(75, 23); @@ -363,9 +363,9 @@ private void InitializeComponent() this.button23.Text = "button23"; this.button23.UseVisualStyleBackColor = true; this.button23.Click += new System.EventHandler(this.button23_Click); - // + // // button24 - // + // this.button24.Location = new System.Drawing.Point(586, 490); this.button24.Name = "button24"; this.button24.Size = new System.Drawing.Size(75, 23); @@ -373,9 +373,9 @@ private void InitializeComponent() this.button24.Text = "button24"; this.button24.UseVisualStyleBackColor = true; this.button24.Click += new System.EventHandler(this.button24_Click); - // + // // button26 - // + // this.button26.Location = new System.Drawing.Point(589, 422); this.button26.Name = "button26"; this.button26.Size = new System.Drawing.Size(75, 23); @@ -383,9 +383,9 @@ private void InitializeComponent() this.button26.Text = "button26"; this.button26.UseVisualStyleBackColor = true; this.button26.Click += new System.EventHandler(this.button26_Click); - // + // // button25 - // + // this.button25.Location = new System.Drawing.Point(589, 391); this.button25.Name = "button25"; this.button25.Size = new System.Drawing.Size(75, 23); @@ -393,26 +393,26 @@ private void InitializeComponent() this.button25.Text = "button25"; this.button25.UseVisualStyleBackColor = true; this.button25.Click += new System.EventHandler(this.button25_Click); - // + // // dataGridView2 - // + // this.dataGridView2.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dataGridView2.Location = new System.Drawing.Point(12, 178); this.dataGridView2.Name = "dataGridView2"; this.dataGridView2.Size = new System.Drawing.Size(361, 80); this.dataGridView2.TabIndex = 34; - // + // // label7 - // + // this.label7.AutoSize = true; this.label7.Location = new System.Drawing.Point(502, 543); this.label7.Name = "label7"; this.label7.Size = new System.Drawing.Size(84, 13); this.label7.TabIndex = 35; this.label7.Text = "Query DataView"; - // + // // button27 - // + // this.button27.Location = new System.Drawing.Point(502, 559); this.button27.Name = "button27"; this.button27.Size = new System.Drawing.Size(75, 23); @@ -420,9 +420,9 @@ private void InitializeComponent() this.button27.Text = "button27"; this.button27.UseVisualStyleBackColor = true; this.button27.Click += new System.EventHandler(this.button27_Click); - // + // // button28 - // + // this.button28.Location = new System.Drawing.Point(586, 559); this.button28.Name = "button28"; this.button28.Size = new System.Drawing.Size(75, 23); @@ -430,9 +430,9 @@ private void InitializeComponent() this.button28.Text = "button28"; this.button28.UseVisualStyleBackColor = true; this.button28.Click += new System.EventHandler(this.button28_Click); - // + // // Form1 - // + // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(679, 603); diff --git a/samples/snippets/csharp/VS_Snippets_ADO.NET/DP DataView Samples/CS/Form1.cs b/samples/snippets/csharp/VS_Snippets_ADO.NET/DP DataView Samples/CS/Form1.cs index 58bc96ee80304..274b305f41011 100644 --- a/samples/snippets/csharp/VS_Snippets_ADO.NET/DP DataView Samples/CS/Form1.cs +++ b/samples/snippets/csharp/VS_Snippets_ADO.NET/DP DataView Samples/CS/Form1.cs @@ -33,8 +33,8 @@ private void Form1_Load(object sender, EventArgs e) private void FillDataSet(DataSet ds) { - // Create a new adapter and give it a query to fetch sales order, contact, - // address, and product information for sales in the year 2002. Point connection + // Create a new adapter and give it a query to fetch sales order, contact, + // address, and product information for sales in the year 2002. Point connection // information to the configuration setting "AdventureWorks". string connectionString = "Data Source=localhost;Initial Catalog=AdventureWorks;" + "Integrated Security=true;"; @@ -200,7 +200,7 @@ static private string SoundEx(string word) value = buffer.ToString(); } // Return the value. - return value; + return value; } // @@ -216,7 +216,7 @@ orderby order.Field("TotalDue") select order; DataView view = query.AsDataView(); - + bindingSource1.DataSource = view; // } @@ -246,7 +246,7 @@ private void button3_Click(object sender, EventArgs e) DataTable contacts = dataSet.Tables["Contact"]; EnumerableRowCollection query = from contact in contacts.AsEnumerable() - where contact.Field("LastName").StartsWith("S") + where contact.Field("LastName").StartsWith("S") select contact; DataView view = query.AsDataView(); @@ -272,7 +272,7 @@ private void button4_Click(object sender, EventArgs e) private void button5_Click(object sender, EventArgs e) { - + // DataTable orders = dataSet.Tables["SalesOrderDetail"]; @@ -342,7 +342,7 @@ orderby order.Field("TotalDue") select order; DataView view = query.AsDataView(); - + bindingSource1.DataSource = view; // @@ -383,7 +383,7 @@ private void button12_Click(object sender, EventArgs e) DataTable orders = dataSet.Tables["SalesOrderHeader"]; EnumerableRowCollection query = from order in orders.AsEnumerable() - orderby order.Field("TotalDue") + orderby order.Field("TotalDue") select order; DataView view = query.AsDataView(); @@ -449,7 +449,7 @@ private void button16_Click(object sender, EventArgs e) DataTable orders = dataSet.Tables["SalesOrderDetail"]; EnumerableRowCollection query = from order in orders.AsEnumerable() - where order.Field("OrderQty") > 2 && order.Field("OrderQty") < 6 + where order.Field("OrderQty") > 2 && order.Field("OrderQty") < 6 select order; DataView view = query.AsDataView(); @@ -471,7 +471,7 @@ where contact.Field("LastName") == "Hernandez" bindingSource1.DataSource = view; dataGridView1.AutoResizeColumns(); - + // } @@ -481,7 +481,7 @@ private void button18_Click(object sender, EventArgs e) DataTable orders = dataSet.Tables["SalesOrderHeader"]; EnumerableRowCollection query = from order in orders.AsEnumerable() - where order.Field("OrderDate") > new DateTime(2002, 6, 1) + where order.Field("OrderDate") > new DateTime(2002, 6, 1) select order; DataView view = query.AsDataView(); @@ -546,7 +546,7 @@ private void button22_Click(object sender, EventArgs e) DataTable products = dataSet.Tables["Product"]; EnumerableRowCollection query = from product in products.AsEnumerable() - orderby product.Field("ListPrice"), product.Field("Color") + orderby product.Field("ListPrice"), product.Field("Color") select product; DataView view = query.AsDataView(); @@ -555,7 +555,7 @@ orderby product.Field("ListPrice"), product.Field("Color") object[] criteria = new object[] { "Red"}; - DataRowView[] foundRowsView = view.FindRows(criteria); + DataRowView[] foundRowsView = view.FindRows(criteria); // } @@ -583,7 +583,7 @@ private void button24_Click(object sender, EventArgs e) DataTable orders = dataSet.Tables["SalesOrderHeader"]; EnumerableRowCollection query = from order in orders.AsEnumerable() - where order.Field("OrderDate") > new DateTime(2002, 11, 20) + where order.Field("OrderDate") > new DateTime(2002, 11, 20) && order.Field("TotalDue") < new Decimal(60.00) select order; @@ -630,7 +630,7 @@ orderby order.Field("OrderDate").Year private void button27_Click(object sender, EventArgs e) { - + DataTable products = dataSet.Tables["Product"]; // Query for red colored products. @@ -643,11 +643,11 @@ orderby product.Field("ListPrice") bindingSource1.DataSource = boundView; // - // Create a table from the bound view representing a query of + // Create a table from the bound view representing a query of // available products. DataView view = (DataView)bindingSource1.DataSource; - DataTable productsTable = (DataTable)view.Table; - + DataTable productsTable = (DataTable)view.Table; + // Set RowStateFilter to display the current rows. view.RowStateFilter = DataViewRowState.CurrentRows ; @@ -658,7 +658,7 @@ orderby rowView.Row.Field("ListPrice") select new { Name = rowView.Row.Field("Name"), Color = rowView.Row.Field("Color"), Price = rowView.Row.Field("ListPrice")}; - + // Bind the query results to another DataGridView. dataGridView2.DataSource = productQuery.ToList(); // @@ -692,7 +692,7 @@ orderby product.Field("ListPrice") // Query for the modified and deleted rows. IEnumerable modifiedDeletedQuery = from DataRowView rowView in view select rowView; - + dataGridView2.DataSource = modifiedDeletedQuery.ToList(); // } diff --git a/samples/snippets/csharp/VS_Snippets_ADO.NET/DP DataViewWinForms Sample/CS/Form1.Designer.cs b/samples/snippets/csharp/VS_Snippets_ADO.NET/DP DataViewWinForms Sample/CS/Form1.Designer.cs index 60d838e988075..04b12700b61f6 100644 --- a/samples/snippets/csharp/VS_Snippets_ADO.NET/DP DataViewWinForms Sample/CS/Form1.Designer.cs +++ b/samples/snippets/csharp/VS_Snippets_ADO.NET/DP DataViewWinForms Sample/CS/Form1.Designer.cs @@ -34,17 +34,17 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.contactDataGridView)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.contactBindingSource)).BeginInit(); this.SuspendLayout(); - // + // // contactDataGridView - // + // this.contactDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.contactDataGridView.Location = new System.Drawing.Point(12, 12); this.contactDataGridView.Name = "contactDataGridView"; this.contactDataGridView.Size = new System.Drawing.Size(360, 150); this.contactDataGridView.TabIndex = 0; - // + // // Form1 - // + // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(401, 273); diff --git a/samples/snippets/csharp/VS_Snippets_ADO.NET/DP DataViewWinForms Sample/CS/Form1.cs b/samples/snippets/csharp/VS_Snippets_ADO.NET/DP DataViewWinForms Sample/CS/Form1.cs index bfd1d59c244d4..4f38229194e00 100644 --- a/samples/snippets/csharp/VS_Snippets_ADO.NET/DP DataViewWinForms Sample/CS/Form1.cs +++ b/samples/snippets/csharp/VS_Snippets_ADO.NET/DP DataViewWinForms Sample/CS/Form1.cs @@ -31,7 +31,7 @@ private void Form1_Load(object sender, EventArgs e) contactDataGridView.DataSource = contactBindingSource; - // Create a LinqDataView from a LINQ to DataSet query and bind it + // Create a LinqDataView from a LINQ to DataSet query and bind it // to the Windows forms control. EnumerableRowCollection contactQuery = from row in dataSet.Tables["Contact"].AsEnumerable() where row.Field("EmailAddress") != null diff --git a/samples/snippets/csharp/VS_Snippets_ADO.NET/DP LINQ to DataSet Examples/CS/Program.cs b/samples/snippets/csharp/VS_Snippets_ADO.NET/DP LINQ to DataSet Examples/CS/Program.cs index 6bcfc33741943..f5919ba1d81f4 100644 --- a/samples/snippets/csharp/VS_Snippets_ADO.NET/DP LINQ to DataSet Examples/CS/Program.cs +++ b/samples/snippets/csharp/VS_Snippets_ADO.NET/DP LINQ to DataSet Examples/CS/Program.cs @@ -59,7 +59,7 @@ static void Main(string[] args) /*** Grouping Operators ***/ //GroupBySimple2(); - //GroupBySimple3(); + //GroupBySimple3(); //GroupByNested(); /*** Set Operators ***/ @@ -85,7 +85,7 @@ static void Main(string[] args) //Range(); // Didn't use Range, couldn't get it to work. /*** Quantifier Operators ***/ - //AnyGrouped_MQ(); + //AnyGrouped_MQ(); //AllGrouped_MQ(); /*** Aggregate Operators ***/ @@ -93,17 +93,17 @@ static void Main(string[] args) //Average_MQ(); //Average2_MQ(); //Count(); - //CountNested(); + //CountNested(); //CountGrouped(); //LongCountSimple(); //SumProjection_MQ(); //SumGrouped_MQ(); //MinProjection_MQ(); //MinGrouped_MQ(); - //MinElements_MQ(); + //MinElements_MQ(); //AverageProjection_MQ(); //AverageGrouped_MQ(); - //AverageElements_MQ(); + //AverageElements_MQ(); //MaxProjection_MQ(); //MaxGrouped_MQ(); MaxElements_MQ(); @@ -122,7 +122,7 @@ static void Main(string[] args) /*** DataRowComparer examples ***/ //CompareDifferentDataRows(); //CompareEqualDataRows(); - //CompareNullDataRows(); + //CompareNullDataRows(); /*** CopyToDataTable examples ***/ //CopyToDataTable1(); @@ -134,7 +134,7 @@ static void Main(string[] args) //OrderBy(); //OrderByDescending(); //Sum(); - //GroupBy(); + //GroupBy(); Console.WriteLine("Hit Enter..."); Console.Read(); @@ -195,8 +195,8 @@ from product in products.AsEnumerable() /*[Category("Projection Operators")] [Title("Select - Anonymous Types ")] - [Description("This example uses Select to project the Name, ProductNumber, and - ListPrice properties to a sequence of anonymous types. The ListPrice + [Description("This example uses Select to project the Name, ProductNumber, and + ListPrice properties to a sequence of anonymous types. The ListPrice property is also renamed to Price in the resulting type.")]*/ static void SelectAnonymousTypes_MQ() { @@ -517,7 +517,7 @@ where product.Field("Color") == "Red" /*[Category("Restriction Operators")] [Title("Where ")] - [Description("This example returns all red colored products. This query does not used the generic Field + [Description("This example returns all red colored products. This query does not used the generic Field method, but explicitly checks column values for null.")]*/ static void WhereIsNull() { @@ -1266,7 +1266,7 @@ where contact.Field("FirstName") == "Sandra" DataTable contacts1 = query1.CopyToDataTable(); DataTable contacts2 = query2.CopyToDataTable(); - // Find the contacts that are in the first + // Find the contacts that are in the first // table but not the second. var contacts = contacts1.AsEnumerable().Except(contacts2.AsEnumerable(), DataRowComparer.Default); @@ -2275,10 +2275,10 @@ where contact.Field("ContactID") == order.Field("ContactID") && foreach (var result in query.Take(10)) { - OnlineOrders.Rows.Add(new object[] { - result.FirstName, - result.LastName, - result.OrderDate, + OnlineOrders.Rows.Add(new object[] { + result.FirstName, + result.LastName, + result.OrderDate, result.TotalDue }); } @@ -2341,7 +2341,7 @@ static void CopyToDataTable1() DataTable orders = ds.Tables["SalesOrderHeader"]; - // Query the SalesOrderHeader table for orders placed + // Query the SalesOrderHeader table for orders placed // after August 8, 2001. IEnumerable query = from order in orders.AsEnumerable() @@ -2351,7 +2351,7 @@ from order in orders.AsEnumerable() // Create a table from the query. DataTable boundTable = query.CopyToDataTable(); - // Bind the table to a System.Windows.Forms.BindingSource object, + // Bind the table to a System.Windows.Forms.BindingSource object, // which acts as a proxy for a System.Windows.Forms.DataGridView object. bindingSource.DataSource = boundTable; // @@ -2621,8 +2621,8 @@ static void FillDataSet(DataSet ds) // try { - // Create a new adapter and give it a query to fetch sales order, contact, - // address, and product information for sales in the year 2002. Point connection + // Create a new adapter and give it a query to fetch sales order, contact, + // address, and product information for sales in the year 2002. Point connection // information to the configuration setting "AdventureWorks". string connectionString = "Data Source=localhost;Initial Catalog=AdventureWorks;" + "Integrated Security=true;"; diff --git a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks BulkCopy.Single/CS/source.cs b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks BulkCopy.Single/CS/source.cs index ddf9cbed2c1ec..59114babed462 100644 --- a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks BulkCopy.Single/CS/source.cs +++ b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks BulkCopy.Single/CS/source.cs @@ -31,17 +31,17 @@ static void Main() SqlDataReader reader = commandSourceData.ExecuteReader(); - // Open the destination connection. In the real world you would - // not use SqlBulkCopy to move data from one table to the other + // Open the destination connection. In the real world you would + // not use SqlBulkCopy to move data from one table to the other // in the same database. This is for demonstration purposes only. using (SqlConnection destinationConnection = new SqlConnection(connectionString)) { destinationConnection.Open(); - // Set up the bulk copy object. + // Set up the bulk copy object. // Note that the column positions in the source - // data reader match the column positions in + // data reader match the column positions in // the destination table so there is no need to // map columns. using (SqlBulkCopy bulkCopy = @@ -68,7 +68,7 @@ static void Main() } } - // Perform a final count on the destination + // Perform a final count on the destination // table to see how many rows were added. long countEnd = System.Convert.ToInt32( commandRowCount.ExecuteScalar()); @@ -81,8 +81,8 @@ static void Main() } private static string GetConnectionString() - // To avoid storing the sourceConnection string in your code, - // you can retrieve it from a configuration file. + // To avoid storing the sourceConnection string in your code, + // you can retrieve it from a configuration file. { return "Data Source=(local); " + " Integrated Security=true;" + diff --git a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks ConnectionStringSettings.RetrieveFromConfigByProvider/CS/source.cs b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks ConnectionStringSettings.RetrieveFromConfigByProvider/CS/source.cs index 3347bc45f69a6..9bb6ea7faae3e 100644 --- a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks ConnectionStringSettings.RetrieveFromConfigByProvider/CS/source.cs +++ b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks ConnectionStringSettings.RetrieveFromConfigByProvider/CS/source.cs @@ -25,7 +25,7 @@ static string GetConnectionStringByProvider(string providerName) ConnectionStringSettingsCollection settings = ConfigurationManager.ConnectionStrings; - // Walk through the collection and return the first + // Walk through the collection and return the first // connection string matching the providerName. if (settings != null) { diff --git a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks ConnectionStrings.Encrypt/CS/source.cs b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks ConnectionStrings.Encrypt/CS/source.cs index 9c4edbb2385bd..62f95b172d007 100644 --- a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks ConnectionStrings.Encrypt/CS/source.cs +++ b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks ConnectionStrings.Encrypt/CS/source.cs @@ -14,7 +14,7 @@ static void ToggleConfigEncryption(string exeFile) // .config extension. try { - // Open the configuration file and retrieve + // Open the configuration file and retrieve // the connectionStrings section. Configuration config = ConfigurationManager. OpenExeConfiguration(exeConfigName); diff --git a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks Data.AcceptRejectRule/CS/source.cs b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks Data.AcceptRejectRule/CS/source.cs index d28c92ff19069..e67a359708f67 100644 --- a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks Data.AcceptRejectRule/CS/source.cs +++ b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks Data.AcceptRejectRule/CS/source.cs @@ -6,7 +6,7 @@ public class Form1: Form { // - private void CreateConstraint(DataSet dataSet, + private void CreateConstraint(DataSet dataSet, string table1, string table2,string column1, string column2) { // Declare parent column and child column variables. diff --git a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks Data.DataTableAdd/CS/source.cs b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks Data.DataTableAdd/CS/source.cs index 061027b181c8b..31a90a539243f 100644 --- a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks Data.DataTableAdd/CS/source.cs +++ b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks Data.DataTableAdd/CS/source.cs @@ -11,7 +11,7 @@ static void Main() DataTable ordersTable = customerOrders.Tables.Add("Orders"); - DataColumn pkOrderID = + DataColumn pkOrderID = ordersTable.Columns.Add("OrderID", typeof(Int32)); ordersTable.Columns.Add("OrderQuantity", typeof(Int32)); ordersTable.Columns.Add("CompanyName", typeof(string)); diff --git a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks DataSet.Merge/CS/source.cs b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks DataSet.Merge/CS/source.cs index f3d7d3b09ada9..9e53535d8b21e 100644 --- a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks DataSet.Merge/CS/source.cs +++ b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks DataSet.Merge/CS/source.cs @@ -16,9 +16,9 @@ private static void ConnectToData(string connectionString) using (SqlConnection connection = new SqlConnection(connectionString)) { - SqlDataAdapter adapter = + SqlDataAdapter adapter = new SqlDataAdapter( - "SELECT CustomerID, CompanyName FROM dbo.Customers", + "SELECT CustomerID, CompanyName FROM dbo.Customers", connection); connection.Open(); @@ -38,7 +38,7 @@ private static void ConnectToData(string connectionString) static private string GetConnectionString() { - // To avoid storing the connection string in your code, + // To avoid storing the connection string in your code, // you can retrieve it from a configuration file. return "Data Source=(local);Initial Catalog=Northwind;" + "Integrated Security=SSPI"; diff --git a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks DataSet.MergeAcceptChanges/CS/source.cs b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks DataSet.MergeAcceptChanges/CS/source.cs index a580cc55a0d10..7d48e9fd589a1 100644 --- a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks DataSet.MergeAcceptChanges/CS/source.cs +++ b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks DataSet.MergeAcceptChanges/CS/source.cs @@ -15,9 +15,9 @@ private static void ConnectToData(string connectionString) using (SqlConnection connection = new SqlConnection(connectionString)) { - SqlDataAdapter adapter = + SqlDataAdapter adapter = new SqlDataAdapter( - "SELECT CustomerID, CompanyName FROM dbo.Customers", + "SELECT CustomerID, CompanyName FROM dbo.Customers", connection); DataSet dataSet = new DataSet(); @@ -68,7 +68,7 @@ protected static void OnRowUpdated( static private string GetConnectionString() { - // To avoid storing the connection string in your code, + // To avoid storing the connection string in your code, // you can retrieve it from a configuration file. return "Data Source=(local);Initial Catalog=Northwind;" + "Integrated Security=SSPI"; diff --git a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks DataTable.CreateDataReader/CS/source.cs b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks DataTable.CreateDataReader/CS/source.cs index 970068226a8e6..c0ba306318302 100644 --- a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks DataTable.CreateDataReader/CS/source.cs +++ b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks DataTable.CreateDataReader/CS/source.cs @@ -10,7 +10,7 @@ static void Main() Console.WriteLine("Press any key to continue."); Console.ReadKey(); } - + private static void TestCreateDataReader(DataTable dt) { // Given a DataTable, retrieve a DataTableReader diff --git a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks DataTable.Events/CS/source.cs b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks DataTable.Events/CS/source.cs index 94f60aa696543..0eb5ccd511fa6 100644 --- a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks DataTable.Events/CS/source.cs +++ b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks DataTable.Events/CS/source.cs @@ -16,7 +16,7 @@ static void DataTableEvents() table.Columns.Add("id", typeof(int)); table.Columns.Add("name", typeof(string)); - // Set the primary key. + // Set the primary key. table.Columns["id"].Unique = true; table.PrimaryKey = new DataColumn[] { table.Columns["id"] }; diff --git a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks DataTableReader.NextResult/CS/source.cs b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks DataTableReader.NextResult/CS/source.cs index 7d95f96f8fc3d..9000326c01405 100644 --- a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks DataTableReader.NextResult/CS/source.cs +++ b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks DataTableReader.NextResult/CS/source.cs @@ -36,11 +36,11 @@ private static DataTable GetCustomers() // Create sample Customers table, in order // to demonstrate the behavior of the DataTableReader. DataTable table = new DataTable(); - + // Create two columns, ID and Name. DataColumn idColumn = table.Columns.Add("ID", typeof(int)); table.Columns.Add("Name", typeof(string )); - + // Set the ID column as the primary key column. table.PrimaryKey = new DataColumn[] { idColumn }; @@ -56,11 +56,11 @@ private static DataTable GetProducts() // Create sample Products table, in order // to demonstrate the behavior of the DataTableReader. DataTable table = new DataTable(); - + // Create two columns, ID and Name. DataColumn idColumn = table.Columns.Add("ID", typeof(int)); table.Columns.Add("Name", typeof(string )); - + // Set the ID column as the primary key column. table.PrimaryKey = new DataColumn[] { idColumn }; diff --git a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks DbProviderFactories.DbCommand/CS/source.cs b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks DbProviderFactories.DbCommand/CS/source.cs index a06388e839666..54b82f44040b9 100644 --- a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks DbProviderFactories.DbCommand/CS/source.cs +++ b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks DbProviderFactories.DbCommand/CS/source.cs @@ -12,7 +12,7 @@ static void Main() } // - // Takes a DbConnection, creates and executes a DbCommand. + // Takes a DbConnection, creates and executes a DbCommand. // Assumes SQL INSERT syntax is supported by provider. static void ExecuteDbCommand(DbConnection connection) { @@ -68,7 +68,7 @@ static DbConnection CreateFactoryConnection(string providerName) // Create the factory if there's a valid connection string. if (connectionString != null) { - DbProviderFactory factory = + DbProviderFactory factory = DbProviderFactories.GetFactory(providerName); // Create the connection. @@ -84,15 +84,15 @@ static DbConnection CreateFactoryConnection(string providerName) } Console.WriteLine(connection.State); - + // Return the open connection. return connection; } return null; } - // Return the connection string for the specified provider. - // If there are multiple connection strings for the same + // Return the connection string for the specified provider. + // If there are multiple connection strings for the same // provider, the first one found is returned. // Returns null if the provider is not found. static string GetConnectionStringByProvider(string providerName) diff --git a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks DbProviderFactories.DbCommandData/CS/source.cs b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks DbProviderFactories.DbCommandData/CS/source.cs index 686b544398c22..26e73d914cf05 100644 --- a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks DbProviderFactories.DbCommandData/CS/source.cs +++ b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks DbProviderFactories.DbCommandData/CS/source.cs @@ -17,7 +17,7 @@ static void Main() // // Takes a DbConnection and creates a DbCommand to retrieve data - // from the Categories table by executing a DbDataReader. + // from the Categories table by executing a DbDataReader. static void DbCommandSelect(DbConnection connection) { string queryString = @@ -82,8 +82,8 @@ static DbConnection CreateFactoryConnection(string providerName) return null; } - // Return the connection string for the specified provider. - // If there are multiple connection strings for the same + // Return the connection string for the specified provider. + // If there are multiple connection strings for the same // provider, the first one found is returned. // Returns null if the provider is not found. static string GetConnectionStringByProvider(string providerName) diff --git a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks DbProviderFactories.GetFactory/CS/source.cs b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks DbProviderFactories.GetFactory/CS/source.cs index a38ed983c070e..776a57a6fb1f3 100644 --- a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks DbProviderFactories.GetFactory/CS/source.cs +++ b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks DbProviderFactories.GetFactory/CS/source.cs @@ -10,7 +10,7 @@ static void Main() { } // - // Given a provider name and connection string, + // Given a provider name and connection string, // create the DbProviderFactory and DbConnection. // Returns a DbConnection on success; null on failure. static DbConnection CreateDbConnection( diff --git a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks DbProviderFactories/CS/source.cs b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks DbProviderFactories/CS/source.cs index 8c96087d6bb16..44f2d394fce71 100644 --- a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks DbProviderFactories/CS/source.cs +++ b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks DbProviderFactories/CS/source.cs @@ -3,7 +3,7 @@ using System.Data.SqlClient; using System.Data.OleDb; using System.Configuration; -using System.Data.Common; +using System.Data.Common; class Program { diff --git a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks LargeValueType.Param/CS/source.cs b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks LargeValueType.Param/CS/source.cs index a4503332d215d..1f55ff4a39b9c 100644 --- a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks LargeValueType.Param/CS/source.cs +++ b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks LargeValueType.Param/CS/source.cs @@ -53,8 +53,8 @@ static private string GetDocumentSummary(int documentID) // static private string GetConnectionString() { - // To avoid storing the connectionection string in your code, - // you can retrieve it from a configuration file, using the + // To avoid storing the connectionection string in your code, + // you can retrieve it from a configuration file, using the // System.Configuration.ConfigurationSettings.AppSettings property return "Data Source=(local);Initial Catalog=AdventureWorks;" + "Integrated Security=SSPI"; diff --git a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks LargeValueType.Photo/CS/source.cs b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks LargeValueType.Photo/CS/source.cs index 21072dbe326cc..a92b12cd2207d 100644 --- a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks LargeValueType.Photo/CS/source.cs +++ b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks LargeValueType.Photo/CS/source.cs @@ -91,9 +91,9 @@ static private void TestGetSqlBytes(int documentID, string filePath) static private string GetConnectionString() { - // To avoid storing the connectionection string in your code, - // you can retrieve it from a configuration file, using the - // System.Configuration.ConfigurationSettings.AppSettings property + // To avoid storing the connectionection string in your code, + // you can retrieve it from a configuration file, using the + // System.Configuration.ConfigurationSettings.AppSettings property return "Data Source=(local);Initial Catalog=AdventureWorks;" + "Integrated Security=SSPI"; } diff --git a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks OleDb.JetAutonumberMerge/CS/source.cs b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks OleDb.JetAutonumberMerge/CS/source.cs index 7f765834582dd..3626e204f222f 100644 --- a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks OleDb.JetAutonumberMerge/CS/source.cs +++ b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks OleDb.JetAutonumberMerge/CS/source.cs @@ -36,8 +36,8 @@ private static void MergeIdentityColumns(OleDbConnection connection) // Create a DataTable DataTable categories = new DataTable(); - // Create the CategoryID column and set its auto - // incrementing properties to decrement from zero. + // Create the CategoryID column and set its auto + // incrementing properties to decrement from zero. DataColumn column = new DataColumn(); column.DataType = System.Type.GetType("System.Int32"); column.ColumnName = "CategoryID"; @@ -78,7 +78,7 @@ private static void MergeIdentityColumns(OleDbConnection connection) adapter.RowUpdated += new OleDbRowUpdatedEventHandler(OnRowUpdated); - // Update the database, inserting the new rows. + // Update the database, inserting the new rows. adapter.Update(dataChanges); Console.WriteLine("Rows before merge:"); @@ -124,7 +124,7 @@ private static void OnRowUpdated( static string GetConnectionString() { - // To avoid storing the connection string in your code, + // To avoid storing the connection string in your code, // you can retrieve it from a configuration file. return "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + "c:\\Data\\Northwind.mdb;User Id=admin;Password=;"; diff --git a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SampleApp.Odbc/CS/source.cs b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SampleApp.Odbc/CS/source.cs index 4386b4f228e55..701071ddb16b7 100644 --- a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SampleApp.Odbc/CS/source.cs +++ b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SampleApp.Odbc/CS/source.cs @@ -8,7 +8,7 @@ class Program { static void Main() { - // The connection string assumes that the Access + // The connection string assumes that the Access // Northwind.mdb is located in the c:\Data folder. string connectionString = "Driver={Microsoft Access Driver (*.mdb)};" @@ -33,7 +33,7 @@ static void Main() OdbcCommand command = new OdbcCommand(queryString, connection); command.Parameters.AddWithValue("@pricePoint", paramValue); - // Open the connection in a try/catch block. + // Open the connection in a try/catch block. // Create and execute the DataReader, writing the result // set to the console window. try @@ -55,4 +55,4 @@ static void Main() } } } -// +// diff --git a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SampleApp.OleDb/CS/source.cs b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SampleApp.OleDb/CS/source.cs index a80ff640e69aa..d420d20bde430 100644 --- a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SampleApp.OleDb/CS/source.cs +++ b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SampleApp.OleDb/CS/source.cs @@ -8,7 +8,7 @@ class Program { static void Main() { - // The connection string assumes that the Access + // The connection string assumes that the Access // Northwind.mdb is located in the c:\Data folder. string connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" @@ -33,7 +33,7 @@ static void Main() OleDbCommand command = new OleDbCommand(queryString, connection); command.Parameters.AddWithValue("@pricePoint", paramValue); - // Open the connection in a try/catch block. + // Open the connection in a try/catch block. // Create and execute the DataReader, writing the result // set to the console window. try diff --git a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SampleApp.Oracle/CS/source.cs b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SampleApp.Oracle/CS/source.cs index 862aaeabe24ef..9332617d85cd7 100644 --- a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SampleApp.Oracle/CS/source.cs +++ b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SampleApp.Oracle/CS/source.cs @@ -7,7 +7,7 @@ class Program { static void Main() { - string connectionString = + string connectionString = "Data Source=ThisOracleServer;Integrated Security=yes;"; string queryString = "SELECT CUSTOMER_ID, NAME FROM DEMO.CUSTOMER"; diff --git a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SampleApp.SqlClient/CS/source.cs b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SampleApp.SqlClient/CS/source.cs index a32eb846b038a..1e25e8e7a50d5 100644 --- a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SampleApp.SqlClient/CS/source.cs +++ b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SampleApp.SqlClient/CS/source.cs @@ -31,7 +31,7 @@ static void Main() SqlCommand command = new SqlCommand(queryString, connection); command.Parameters.AddWithValue("@pricePoint", paramValue); - // Open the connection in a try/catch block. + // Open the connection in a try/catch block. // Create and execute the DataReader, writing the result // set to the console window. try diff --git a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SnapshotIsolation.Demo/CS/source.cs b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SnapshotIsolation.Demo/CS/source.cs index e06a7e7120648..465fecc7e706e 100644 --- a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SnapshotIsolation.Demo/CS/source.cs +++ b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SnapshotIsolation.Demo/CS/source.cs @@ -8,7 +8,7 @@ static void Main() { // // Assumes GetConnectionString returns a valid connection string - // where pooling is turned off by setting Pooling=False;. + // where pooling is turned off by setting Pooling=False;. string connectionString = GetConnectionString(); using (SqlConnection connection1 = new SqlConnection(connectionString)) { @@ -39,9 +39,9 @@ static void Main() "INSERT INTO TestSnapshot VALUES (1,1)"; command1.ExecuteNonQuery(); - // Begin, but do not complete, a transaction to update the data + // Begin, but do not complete, a transaction to update the data // with the Serializable isolation level, which locks the table - // pending the commit or rollback of the update. The original + // pending the commit or rollback of the update. The original // value in valueCol was 1, the proposed new value is 22. SqlTransaction transaction1 = connection1.BeginTransaction(IsolationLevel.Serializable); @@ -55,7 +55,7 @@ static void Main() { connection2.Open(); // Initiate a second transaction to read from TestSnapshot - // using Snapshot isolation. This will read the original + // using Snapshot isolation. This will read the original // value of 1 since transaction1 has not yet committed. SqlCommand command2 = connection2.CreateCommand(); SqlTransaction transaction2 = @@ -76,7 +76,7 @@ static void Main() // Open a third connection to AdventureWorks and // initiate a third transaction to read from TestSnapshot // using ReadCommitted isolation level. This transaction - // will not be able to view the data because of + // will not be able to view the data because of // the locks placed on the table in transaction1 // and will time out after 4 seconds. // You would see the same behavior with the @@ -111,7 +111,7 @@ static void Main() // Open a fourth connection to AdventureWorks and // initiate a fourth transaction to read from TestSnapshot // using the ReadUncommitted isolation level. ReadUncommitted - // will not hit the table lock, and will allow a dirty read + // will not hit the table lock, and will allow a dirty read // of the proposed new value 22 for valueCol. If the first // transaction rolls back, this value will never actually have // existed in the database. @@ -166,8 +166,8 @@ static void Main() static private string GetConnectionString() { - // To avoid storing the connection string in your code, - // you can retrieve it from a configuration file, using the + // To avoid storing the connection string in your code, + // you can retrieve it from a configuration file, using the // System.Configuration.ConfigurationSettings.AppSettings property return "Data Source=localhost;Initial Catalog=AdventureWorks;" + "Integrated Security=SSPI"; diff --git a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SnapshotIsolation.DemoUpdate/CS/source.cs b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SnapshotIsolation.DemoUpdate/CS/source.cs index 0e36a91386cf3..f097da3446646 100644 --- a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SnapshotIsolation.DemoUpdate/CS/source.cs +++ b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SnapshotIsolation.DemoUpdate/CS/source.cs @@ -9,7 +9,7 @@ static void Main() { // // Assumes GetConnectionString returns a valid connection string - // where pooling is turned off by setting Pooling=False;. + // where pooling is turned off by setting Pooling=False;. string connectionString = GetConnectionString(); using (SqlConnection connection1 = new SqlConnection(connectionString)) { @@ -29,7 +29,7 @@ static void Main() { Console.WriteLine("ALLOW_SNAPSHOT_ISOLATION ON failed: {0}", ex.Message); } - // Create a table + // Create a table command1.CommandText = "IF EXISTS " + "(SELECT * FROM sys.tables " @@ -63,7 +63,7 @@ static void Main() Console.WriteLine(ex.Message); } - // Begin, but do not complete, a transaction + // Begin, but do not complete, a transaction // using the Snapshot isolation level. SqlTransaction transaction1 = null; try @@ -162,9 +162,9 @@ static void Main() static private string GetConnectionString() { - // To avoid storing the connection string in your code, - // you can retrieve it from a configuration file, using the - // System.Configuration.ConfigurationSettings.AppSettings property + // To avoid storing the connection string in your code, + // you can retrieve it from a configuration file, using the + // System.Configuration.ConfigurationSettings.AppSettings property return "Data Source=(local);Initial Catalog=AdventureWorks;" + "Integrated Security=SSPI;Pooling=false"; } diff --git a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlBulkCopy.ColumnMapping/CS/source.cs b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlBulkCopy.ColumnMapping/CS/source.cs index 29ea46149af5b..5202103f3eb1b 100644 --- a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlBulkCopy.ColumnMapping/CS/source.cs +++ b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlBulkCopy.ColumnMapping/CS/source.cs @@ -69,7 +69,7 @@ static void Main() } } - // Perform a final count on the destination + // Perform a final count on the destination // table to see how many rows were added. long countEnd = System.Convert.ToInt32( commandRowCount.ExecuteScalar()); @@ -81,8 +81,8 @@ static void Main() } private static string GetConnectionString() - // To avoid storing the sourceConnection string in your code, - // you can retrieve it from a configuration file. + // To avoid storing the sourceConnection string in your code, + // you can retrieve it from a configuration file. { return "Data Source=(local); " + " Integrated Security=true;" + diff --git a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlBulkCopy.ColumnMappingOrdersDetails/CS/source.cs b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlBulkCopy.ColumnMappingOrdersDetails/CS/source.cs index a2952aa2da36b..4ef3d70b30bd8 100644 --- a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlBulkCopy.ColumnMappingOrdersDetails/CS/source.cs +++ b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlBulkCopy.ColumnMappingOrdersDetails/CS/source.cs @@ -14,7 +14,7 @@ static void Main() { connection.Open(); - // Empty the destination tables. + // Empty the destination tables. SqlCommand deleteHeader = new SqlCommand( "DELETE FROM dbo.BulkCopyDemoOrderHeader;", connection); @@ -25,7 +25,7 @@ static void Main() deleteDetail.ExecuteNonQuery(); // Perform an initial count on the destination - // table with matching columns. + // table with matching columns. SqlCommand countRowHeader = new SqlCommand( "SELECT COUNT(*) FROM dbo.BulkCopyDemoOrderHeader;", connection); @@ -36,7 +36,7 @@ static void Main() countStartHeader); // Perform an initial count on the destination - // table with different column positions. + // table with different column positions. SqlCommand countRowDetail = new SqlCommand( "SELECT COUNT(*) FROM dbo.BulkCopyDemoOrderDetail;", connection); @@ -49,10 +49,10 @@ static void Main() // Get data from the source table as a SqlDataReader. // The Sales.SalesOrderHeader and Sales.SalesOrderDetail // tables are quite large and could easily cause a timeout - // if all data from the tables is added to the destination. - // To keep the example simple and quick, a parameter is - // used to select only orders for a particular account - // as the source for the bulk insert. + // if all data from the tables is added to the destination. + // To keep the example simple and quick, a parameter is + // used to select only orders for a particular account + // as the source for the bulk insert. SqlCommand headerData = new SqlCommand( "SELECT [SalesOrderID], [OrderDate], " + "[AccountNumber] FROM [Sales].[SalesOrderHeader] " + @@ -85,7 +85,7 @@ static void Main() sourceDetailData.Parameters.Add(accountDetail); SqlDataReader readerDetail = sourceDetailData.ExecuteReader(); - // Create the SqlBulkCopy object. + // Create the SqlBulkCopy object. using (SqlBulkCopy bulkCopy = new SqlBulkCopy(connectionString)) { @@ -112,7 +112,7 @@ static void Main() readerHeader.Close(); } - // Set up the order details destination. + // Set up the order details destination. bulkCopy.DestinationTableName ="dbo.BulkCopyDemoOrderDetail"; // Clear the ColumnMappingCollection. @@ -141,7 +141,7 @@ static void Main() } // Perform a final count on the destination - // tables to see how many rows were added. + // tables to see how many rows were added. long countEndHeader = System.Convert.ToInt32( countRowHeader.ExecuteScalar()); Console.WriteLine("{0} rows were added to the Header table.", @@ -157,8 +157,8 @@ static void Main() } private static string GetConnectionString() - // To avoid storing the connection string in your code, - // you can retrieve it from a configuration file. + // To avoid storing the connection string in your code, + // you can retrieve it from a configuration file. { return "Data Source=(local); " + " Integrated Security=true;" + diff --git a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlBulkCopy.DefaultTransaction/CS/source.cs b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlBulkCopy.DefaultTransaction/CS/source.cs index a4662d34f3de4..ddb99fae6a9a4 100644 --- a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlBulkCopy.DefaultTransaction/CS/source.cs +++ b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlBulkCopy.DefaultTransaction/CS/source.cs @@ -14,23 +14,23 @@ static void Main() { sourceConnection.Open(); - // Delete all from the destination table. + // Delete all from the destination table. SqlCommand commandDelete = new SqlCommand(); commandDelete.Connection = sourceConnection; commandDelete.CommandText = "DELETE FROM dbo.BulkCopyDemoMatchingColumns"; commandDelete.ExecuteNonQuery(); - // Add a single row that will result in duplicate key - // when all rows from source are bulk copied. - // Note that this technique will only be successful in - // illustrating the point if a row with ProductID = 446 - // exists in the AdventureWorks Production.Products table. - // If you have made changes to the data in this table, change - // the SQL statement in the code to add a ProductID that - // does exist in your version of the Production.Products - // table. Choose any ProductID in the middle of the table - // (not first or last row) to best illustrate the result. + // Add a single row that will result in duplicate key + // when all rows from source are bulk copied. + // Note that this technique will only be successful in + // illustrating the point if a row with ProductID = 446 + // exists in the AdventureWorks Production.Products table. + // If you have made changes to the data in this table, change + // the SQL statement in the code to add a ProductID that + // does exist in your version of the Production.Products + // table. Choose any ProductID in the middle of the table + // (not first or last row) to best illustrate the result. SqlCommand commandInsert = new SqlCommand(); commandInsert.Connection = sourceConnection; commandInsert.CommandText = @@ -49,13 +49,13 @@ static void Main() commandRowCount.ExecuteScalar()); Console.WriteLine("Starting row count = {0}", countStart); - // Get data from the source table as a SqlDataReader. + // Get data from the source table as a SqlDataReader. SqlCommand commandSourceData = new SqlCommand( "SELECT ProductID, Name, ProductNumber " + "FROM Production.Product;", sourceConnection); SqlDataReader reader = commandSourceData.ExecuteReader(); - // Set up the bulk copy object using the KeepIdentity option. + // Set up the bulk copy object using the KeepIdentity option. using (SqlBulkCopy bulkCopy = new SqlBulkCopy( connectionString, SqlBulkCopyOptions.KeepIdentity)) { @@ -80,7 +80,7 @@ static void Main() } } - // Perform a final count on the destination + // Perform a final count on the destination // table to see how many rows were added. long countEnd = System.Convert.ToInt32( commandRowCount.ExecuteScalar()); @@ -92,8 +92,8 @@ static void Main() } private static string GetConnectionString() - // To avoid storing the sourceConnection string in your code, - // you can retrieve it from a configuration file. + // To avoid storing the sourceConnection string in your code, + // you can retrieve it from a configuration file. { return "Data Source=(local); " + " Integrated Security=true;" + diff --git a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlBulkCopy.InternalTransaction/CS/source.cs b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlBulkCopy.InternalTransaction/CS/source.cs index 69c5dcaff1880..155d590ba6ca3 100644 --- a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlBulkCopy.InternalTransaction/CS/source.cs +++ b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlBulkCopy.InternalTransaction/CS/source.cs @@ -14,23 +14,23 @@ static void Main() { sourceConnection.Open(); - // Delete all from the destination table. + // Delete all from the destination table. SqlCommand commandDelete = new SqlCommand(); commandDelete.Connection = sourceConnection; commandDelete.CommandText = "DELETE FROM dbo.BulkCopyDemoMatchingColumns"; commandDelete.ExecuteNonQuery(); - // Add a single row that will result in duplicate key - // when all rows from source are bulk copied. - // Note that this technique will only be successful in - // illustrating the point if a row with ProductID = 446 - // exists in the AdventureWorks Production.Products table. - // If you have made changes to the data in this table, change - // the SQL statement in the code to add a ProductID that - // does exist in your version of the Production.Products - // table. Choose any ProductID in the middle of the table - // (not first or last row) to best illustrate the result. + // Add a single row that will result in duplicate key + // when all rows from source are bulk copied. + // Note that this technique will only be successful in + // illustrating the point if a row with ProductID = 446 + // exists in the AdventureWorks Production.Products table. + // If you have made changes to the data in this table, change + // the SQL statement in the code to add a ProductID that + // does exist in your version of the Production.Products + // table. Choose any ProductID in the middle of the table + // (not first or last row) to best illustrate the result. SqlCommand commandInsert = new SqlCommand(); commandInsert.Connection = sourceConnection; commandInsert.CommandText = @@ -49,7 +49,7 @@ static void Main() commandRowCount.ExecuteScalar()); Console.WriteLine("Starting row count = {0}", countStart); - // Get data from the source table as a SqlDataReader. + // Get data from the source table as a SqlDataReader. SqlCommand commandSourceData = new SqlCommand( "SELECT ProductID, Name, ProductNumber " + "FROM Production.Product;", sourceConnection); @@ -60,7 +60,7 @@ static void Main() // option, you cannot also specify an external transaction. // Therefore, you must use the SqlBulkCopy construct that // requires a string for the connection, rather than an - // existing SqlConnection object. + // existing SqlConnection object. using (SqlBulkCopy bulkCopy = new SqlBulkCopy( connectionString, SqlBulkCopyOptions.KeepIdentity | SqlBulkCopyOptions.UseInternalTransaction)) @@ -86,7 +86,7 @@ static void Main() } } - // Perform a final count on the destination + // Perform a final count on the destination // table to see how many rows were added. long countEnd = System.Convert.ToInt32( commandRowCount.ExecuteScalar()); @@ -98,8 +98,8 @@ static void Main() } private static string GetConnectionString() - // To avoid storing the sourceConnection string in your code, - // you can retrieve it from a configuration file. + // To avoid storing the sourceConnection string in your code, + // you can retrieve it from a configuration file. { return "Data Source=(local); " + " Integrated Security=true;" + diff --git a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlBulkCopy.SqlTransaction/CS/source.cs b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlBulkCopy.SqlTransaction/CS/source.cs index faa75c2b59b8d..da370fe644422 100644 --- a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlBulkCopy.SqlTransaction/CS/source.cs +++ b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlBulkCopy.SqlTransaction/CS/source.cs @@ -14,23 +14,23 @@ static void Main() { sourceConnection.Open(); - // Delete all from the destination table. + // Delete all from the destination table. SqlCommand commandDelete = new SqlCommand(); commandDelete.Connection = sourceConnection; commandDelete.CommandText = "DELETE FROM dbo.BulkCopyDemoMatchingColumns"; commandDelete.ExecuteNonQuery(); - // Add a single row that will result in duplicate key - // when all rows from source are bulk copied. - // Note that this technique will only be successful in - // illustrating the point if a row with ProductID = 446 - // exists in the AdventureWorks Production.Products table. - // If you have made changes to the data in this table, change - // the SQL statement in the code to add a ProductID that - // does exist in your version of the Production.Products - // table. Choose any ProductID in the middle of the table - // (not first or last row) to best illustrate the result. + // Add a single row that will result in duplicate key + // when all rows from source are bulk copied. + // Note that this technique will only be successful in + // illustrating the point if a row with ProductID = 446 + // exists in the AdventureWorks Production.Products table. + // If you have made changes to the data in this table, change + // the SQL statement in the code to add a ProductID that + // does exist in your version of the Production.Products + // table. Choose any ProductID in the middle of the table + // (not first or last row) to best illustrate the result. SqlCommand commandInsert = new SqlCommand(); commandInsert.Connection = sourceConnection; commandInsert.CommandText = @@ -49,13 +49,13 @@ static void Main() commandRowCount.ExecuteScalar()); Console.WriteLine("Starting row count = {0}", countStart); - // Get data from the source table as a SqlDataReader. + // Get data from the source table as a SqlDataReader. SqlCommand commandSourceData = new SqlCommand( "SELECT ProductID, Name, ProductNumber " + "FROM Production.Product;", sourceConnection); SqlDataReader reader = commandSourceData.ExecuteReader(); - //Set up the bulk copy object inside the transaction. + //Set up the bulk copy object inside the transaction. using (SqlConnection destinationConnection = new SqlConnection(connectionString)) { @@ -92,7 +92,7 @@ static void Main() } } - // Perform a final count on the destination + // Perform a final count on the destination // table to see how many rows were added. long countEnd = System.Convert.ToInt32( commandRowCount.ExecuteScalar()); @@ -104,8 +104,8 @@ static void Main() } private static string GetConnectionString() - // To avoid storing the sourceConnection string in your code, - // you can retrieve it from a configuration file. + // To avoid storing the sourceConnection string in your code, + // you can retrieve it from a configuration file. { return "Data Source=(local); " + " Integrated Security=true;" + diff --git a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlClient.CAS/CS/source.cs b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlClient.CAS/CS/source.cs index ff107723ba3ca..067b112defcf7 100644 --- a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlClient.CAS/CS/source.cs +++ b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlClient.CAS/CS/source.cs @@ -4,7 +4,7 @@ using System.Data.SqlClient; using System.Security; using System.Security.Permissions; - + namespace PartialTrustTopic { public class PartialTrustHelper : MarshalByRefObject { public void TestConnectionOpen(string connectionString) { @@ -14,28 +14,28 @@ public void TestConnectionOpen(string connectionString) { } } } - + class Program { static void Main(string[] args) { TestCAS("Data Source=(local);Integrated Security=true", "Data Source=(local);Integrated Security=true;Initial Catalog=Test"); } - + static void TestCAS(string connectString1, string connectString2) { // Create permission set for sandbox AppDomain. // This example only allows execution. PermissionSet permissions = new PermissionSet(PermissionState.None); permissions.AddPermission(new SecurityPermission(SecurityPermissionFlag.Execution)); - + // Create sandbox AppDomain with permission set that only allows execution, // and has no SqlClientPermissions. AppDomainSetup appDomainSetup = new AppDomainSetup(); appDomainSetup.ApplicationBase = AppDomain.CurrentDomain.SetupInformation.ApplicationBase; AppDomain firstDomain = AppDomain.CreateDomain("NoSqlPermissions", null, appDomainSetup, permissions); - + // Create helper object in sandbox AppDomain so that code can be executed in that AppDomain. Type helperType = typeof(PartialTrustHelper); PartialTrustHelper firstHelper = (PartialTrustHelper)firstDomain.CreateInstanceAndUnwrap(helperType.Assembly.FullName, helperType.FullName); - + try { // Attempt to open a connection in the sandbox AppDomain. // This is expected to fail. @@ -45,20 +45,20 @@ static void TestCAS(string connectString1, string connectString2) { catch (System.Security.SecurityException ex) { Console.WriteLine("Failed, as expected: {0}", ex.FirstPermissionThatFailed); - + // Uncomment the following line to see Exception details. // Console.WriteLine("BaseException: " + ex.GetBaseException()); } - + // Add permission for a specific connection string. SqlClientPermission sqlPermission = new SqlClientPermission(PermissionState.None); sqlPermission.Add(connectString1, "", KeyRestrictionBehavior.AllowOnly); - + permissions.AddPermission(sqlPermission); - + AppDomain secondDomain = AppDomain.CreateDomain("OneSqlPermission", null, appDomainSetup, permissions); PartialTrustHelper secondHelper = (PartialTrustHelper)secondDomain.CreateInstanceAndUnwrap(helperType.Assembly.FullName, helperType.FullName); - + // Try connection open again, it should succeed now. try { secondHelper.TestConnectionOpen(connectString1); @@ -67,7 +67,7 @@ static void TestCAS(string connectString1, string connectString2) { catch (System.Security.SecurityException ex) { Console.WriteLine("Unexpected failure: {0}", ex.Message); } - + // Try a different connection string. This should fail. try { secondHelper.TestConnectionOpen(connectString2); diff --git a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlClient.DataAdapterUpdate/CS/source.cs b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlClient.DataAdapterUpdate/CS/source.cs index 580e90b9eebab..0d7367469b976 100644 --- a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlClient.DataAdapterUpdate/CS/source.cs +++ b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlClient.DataAdapterUpdate/CS/source.cs @@ -53,7 +53,7 @@ private static void AdapterUpdate(string connectionString) static private string GetConnectionString() { - // To avoid storing the connection string in your code, + // To avoid storing the connection string in your code, // you can retrieve it from a configuration file. return "Data Source=(local);Initial Catalog=Northwind;" + "Integrated Security=true"; diff --git a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlClient.GetSchemaTable/CS/source.cs b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlClient.GetSchemaTable/CS/source.cs index cee593a4486b4..a0e3da5ca2b40 100644 --- a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlClient.GetSchemaTable/CS/source.cs +++ b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlClient.GetSchemaTable/CS/source.cs @@ -40,7 +40,7 @@ static void GetSchemaInfo(SqlConnection connection) static private string GetConnectionString() { - // To avoid storing the connection string in your code, + // To avoid storing the connection string in your code, // you can retrieve it from a configuration file. return "Data Source=(local);Initial Catalog=Northwind;" + "Integrated Security=SSPI"; diff --git a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlClient.GetXmlDataReader/CS/source.cs b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlClient.GetXmlDataReader/CS/source.cs index bcae231cda759..dc3094b0d84cd 100644 --- a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlClient.GetXmlDataReader/CS/source.cs +++ b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlClient.GetXmlDataReader/CS/source.cs @@ -25,10 +25,10 @@ static void GetXmlData(string connectionString) { connection.Open(); - // The query includes two specific customers for simplicity's + // The query includes two specific customers for simplicity's // sake. A more realistic approach would use a parameter // for the CustomerID criteria. The example selects two rows - // in order to demonstrate reading first from one row to + // in order to demonstrate reading first from one row to // another, then from one node to another within the xml column. string commandText = "SELECT Demographics from Sales.Store WHERE " + @@ -39,24 +39,24 @@ static void GetXmlData(string connectionString) SqlDataReader salesReaderData = commandSales.ExecuteReader(); // Multiple rows are returned by the SELECT, so each row - // is read and an XmlReader (an xml data type) is set to the - // value of its first (and only) column. + // is read and an XmlReader (an xml data type) is set to the + // value of its first (and only) column. int countRow = 1; while (salesReaderData.Read()) - // Must use GetSqlXml here to get a SqlXml type. - // GetValue returns a string instead of SqlXml. + // Must use GetSqlXml here to get a SqlXml type. + // GetValue returns a string instead of SqlXml. { SqlXml salesXML = salesReaderData.GetSqlXml(0); XmlReader salesReaderXml = salesXML.CreateReader(); Console.WriteLine("-----Row " + countRow + "-----"); - // Move to the root. + // Move to the root. salesReaderXml.MoveToContent(); // We know each node type is either Element or Text. - // All elements within the root are string values. - // For this simple example, no elements are empty. + // All elements within the root are string values. + // For this simple example, no elements are empty. while (salesReaderXml.Read()) { if (salesReaderXml.NodeType == XmlNodeType.Element) diff --git a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlClient.HasRows/CS/source.cs b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlClient.HasRows/CS/source.cs index a2cd3bc0eefaf..96fe012ecdeab 100644 --- a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlClient.HasRows/CS/source.cs +++ b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlClient.HasRows/CS/source.cs @@ -43,7 +43,7 @@ static void HasRows(SqlConnection connection) // static private string GetConnectionString() { - // To avoid storing the connection string in your code, + // To avoid storing the connection string in your code, // you can retrieve it from a configuration file. return "Data Source=(local);Initial Catalog=Northwind;" + "Integrated Security=SSPI"; diff --git a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlClient.MergeIdentity/CS/source.cs b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlClient.MergeIdentity/CS/source.cs index b6804dd921bf3..70bc8ec8cd385 100644 --- a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlClient.MergeIdentity/CS/source.cs +++ b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlClient.MergeIdentity/CS/source.cs @@ -35,7 +35,7 @@ private static void MergeIdentityColumns(string connectionString) "CompanyName")); adapter.InsertCommand.UpdatedRowSource = UpdateRowSource.Both; - // MissingSchemaAction adds any missing schema to + // MissingSchemaAction adds any missing schema to // the DataTable, including identity columns adapter.MissingSchemaAction = MissingSchemaAction.AddWithKey; @@ -43,7 +43,7 @@ private static void MergeIdentityColumns(string connectionString) DataTable shipper = new DataTable(); adapter.Fill(shipper); - // Add a new shipper. + // Add a new shipper. DataRow newRow = shipper.NewRow(); newRow["CompanyName"] = "New Shipper"; shipper.Rows.Add(newRow); @@ -52,7 +52,7 @@ private static void MergeIdentityColumns(string connectionString) // DataTable will be used by the DataAdapter. DataTable dataChanges = shipper.GetChanges(); - // Add the event handler. + // Add the event handler. adapter.RowUpdated += new SqlRowUpdatedEventHandler(OnRowUpdated); @@ -90,7 +90,7 @@ protected static void OnRowUpdated( static private string GetConnectionString() { - // To avoid storing the connection string in your code, + // To avoid storing the connection string in your code, // you can retrieve it from a configuration file. return "Data Source=(local);Initial Catalog=Northwind;" + "Integrated Security=true"; diff --git a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlClient.NextResult/CS/source.cs b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlClient.NextResult/CS/source.cs index 796a8ad776a75..d4c85f4b5ae9c 100644 --- a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlClient.NextResult/CS/source.cs +++ b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlClient.NextResult/CS/source.cs @@ -45,7 +45,7 @@ static void RetrieveMultipleResults(SqlConnection connection) // static private string GetConnectionString() { - // To avoid storing the connection string in your code, + // To avoid storing the connection string in your code, // you can retrieve it from a configuration file. return "Data Source=(local);Initial Catalog=Northwind;" + "Integrated Security=SSPI"; diff --git a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlClient.RetrieveIdentityStoredProcedure/CS/source.cs b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlClient.RetrieveIdentityStoredProcedure/CS/source.cs index a42b361dd8ba5..2bd4353ef1c2a 100644 --- a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlClient.RetrieveIdentityStoredProcedure/CS/source.cs +++ b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlClient.RetrieveIdentityStoredProcedure/CS/source.cs @@ -23,7 +23,7 @@ private static void RetrieveIdentity(string connectionString) connection); //Create the SqlCommand to execute the stored procedure. - adapter.InsertCommand = new SqlCommand("dbo.InsertCategory", + adapter.InsertCommand = new SqlCommand("dbo.InsertCategory", connection); adapter.InsertCommand.CommandType = CommandType.StoredProcedure; @@ -35,7 +35,7 @@ private static void RetrieveIdentity(string connectionString) // Add the SqlParameter to retrieve the new identity value. // Specify the ParameterDirection as Output. - SqlParameter parameter = + SqlParameter parameter = adapter.InsertCommand.Parameters.Add( "@Identity", SqlDbType.Int, 0, "CategoryID"); parameter.Direction = ParameterDirection.Output; @@ -44,7 +44,7 @@ private static void RetrieveIdentity(string connectionString) DataTable categories = new DataTable(); adapter.Fill(categories); - // Add a new row. + // Add a new row. DataRow newRow = categories.NewRow(); newRow["CategoryName"] = "New Category"; categories.Rows.Add(newRow); @@ -64,7 +64,7 @@ private static void RetrieveIdentity(string connectionString) static private string GetConnectionString() { - // To avoid storing the connection string in your code, + // To avoid storing the connection string in your code, // you can retrieve it from a configuration file. return "Data Source=(local);Initial Catalog=Northwind;" + "Integrated Security=true"; diff --git a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlClient.SprocIdentityReturn/CS/source.cs b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlClient.SprocIdentityReturn/CS/source.cs index 5898e1d70eb95..e6d54cf8d5614 100644 --- a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlClient.SprocIdentityReturn/CS/source.cs +++ b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlClient.SprocIdentityReturn/CS/source.cs @@ -61,7 +61,7 @@ private static void ReturnIdentity(string connectionString) static private string GetConnectionString() { - // To avoid storing the connection string in your code, + // To avoid storing the connection string in your code, // you can retrieve it from a configuration file. return "Data Source=(local);Initial Catalog=Northwind;Integrated Security=true"; } diff --git a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlClient.StoredProcedure/CS/source.cs b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlClient.StoredProcedure/CS/source.cs index b934419e0d456..1559d56e69f40 100644 --- a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlClient.StoredProcedure/CS/source.cs +++ b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlClient.StoredProcedure/CS/source.cs @@ -29,7 +29,7 @@ static void GetSalesByCategory(string connectionString, parameter.Direction = ParameterDirection.Input; parameter.Value = categoryName; - // Add the parameter to the Parameters collection. + // Add the parameter to the Parameters collection. command.Parameters.Add(parameter); // Open the connection and execute the reader. diff --git a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlCommand.ExecuteScalar/CS/source.cs b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlCommand.ExecuteScalar/CS/source.cs index 1984c26ad3e93..3dc28f824a31b 100644 --- a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlCommand.ExecuteScalar/CS/source.cs +++ b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlCommand.ExecuteScalar/CS/source.cs @@ -37,7 +37,7 @@ static public int AddProductCategory(string newName, string connString) // static private string GetConnectionString() { - // To avoid storing the connection string in your code, + // To avoid storing the connection string in your code, // you can retrieve it from a configuration file. return "Data Source=(local);Initial Catalog=AdventureWorks;" + "Integrated Security=true"; diff --git a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlConnectionStringBuilder/CS/source.cs b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlConnectionStringBuilder/CS/source.cs index 0effb8b5b8afe..157e8c853f0f0 100644 --- a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlConnectionStringBuilder/CS/source.cs +++ b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlConnectionStringBuilder/CS/source.cs @@ -14,12 +14,12 @@ static void Main() SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder(GetConnectionString()); - // The input connection string used the + // The input connection string used the // Server key, but the new connection string uses // the well-known Data Source key instead. Console.WriteLine(builder.ConnectionString); - // Pass the SqlConnectionStringBuilder an existing + // Pass the SqlConnectionStringBuilder an existing // connection string, and you can retrieve and // modify any of the elements. builder.ConnectionString = "server=(local);user id=ab;" + @@ -31,7 +31,7 @@ static void Main() builder.Password = "new@1Password"; builder.AsynchronousProcessing = true; - // You can refer to connection keys using strings, + // You can refer to connection keys using strings, // as well. When you use this technique (the default // Item property in Visual Basic, or the indexer in C#), // you can specify any synonym for the connection string key @@ -48,7 +48,7 @@ static void Main() private static string GetConnectionString() { // To avoid storing the connection string in your code, - // you can retrieve it from a configuration file. + // you can retrieve it from a configuration file. return "Server=(local);Integrated Security=SSPI;" + "Initial Catalog=AdventureWorks"; } diff --git a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlTransaction.Local/CS/source.cs b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlTransaction.Local/CS/source.cs index 4babf484d67b2..d59c5265227ff 100644 --- a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlTransaction.Local/CS/source.cs +++ b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlTransaction.Local/CS/source.cs @@ -8,7 +8,7 @@ class Program { static void Main() { - string connectionString = + string connectionString = "Persist Security Info=False;Integrated Security=true;database=Northwind;server=(local)"; LocalTrans(connectionString); Console.ReadLine(); @@ -53,8 +53,8 @@ private static void LocalTrans(string connectionString) } catch (Exception exRollback) { - // Throws an InvalidOperationException if the connection - // is closed or the transaction has already been rolled + // Throws an InvalidOperationException if the connection + // is closed or the transaction has already been rolled // back on the server. Console.WriteLine(exRollback.Message); } diff --git a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlTypes.CompareNulls/CS/source.cs b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlTypes.CompareNulls/CS/source.cs index c9157fe15f1e6..c05f4c0a97f6e 100644 --- a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlTypes.CompareNulls/CS/source.cs +++ b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlTypes.CompareNulls/CS/source.cs @@ -41,7 +41,7 @@ private static void CompareNulls() Console.WriteLine("String.Equals instance method:"); Console.WriteLine(" Two empty strings={0}", StringEquals(a, b)); } - + private static string SqlStringEquals(SqlString string1, SqlString string2) { // SqlString.Equals uses database semantics for evaluating nulls. diff --git a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlTypes.GetTypeAW/CS/source.cs b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlTypes.GetTypeAW/CS/source.cs index 3453f113213ea..abeaebcd17d7f 100644 --- a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlTypes.GetTypeAW/CS/source.cs +++ b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlTypes.GetTypeAW/CS/source.cs @@ -77,9 +77,9 @@ static private void GetSqlTypesAW(string connectionString) static private string GetConnectionString() { - // To avoid storing the connection string in your code, - // you can retrieve it from a configuration file, using the - // System.Configuration.ConfigurationSettings.AppSettings property + // To avoid storing the connection string in your code, + // you can retrieve it from a configuration file, using the + // System.Configuration.ConfigurationSettings.AppSettings property return "Data Source=(local);Initial Catalog=AdventureWorks;" + "Integrated Security=SSPI;"; } diff --git a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlTypes.Guid/CS/source.cs b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlTypes.Guid/CS/source.cs index 191194a17dc60..6467d345af880 100644 --- a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlTypes.Guid/CS/source.cs +++ b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlTypes.Guid/CS/source.cs @@ -37,7 +37,7 @@ private static void WorkWithGuids() Console.WriteLine(" {0}", guidSorted); } Console.WriteLine(""); - + // Create an ArrayList of SqlGuids. ArrayList sqlGuidList = new ArrayList(); sqlGuidList.Add(new SqlGuid("3AAAAAAA-BBBB-CCCC-DDDD-2EEEEEEEEEEE")); diff --git a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlTypes.IsNull/CS/source.cs b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlTypes.IsNull/CS/source.cs index 35022e1e49e9b..4f326c6bb5228 100644 --- a/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlTypes.IsNull/CS/source.cs +++ b/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks SqlTypes.IsNull/CS/source.cs @@ -42,7 +42,7 @@ static private void WorkWithSqlNulls() // Iterate through the DataTable and display the values. foreach (DataRow row in table.Rows) { - // Assign values to variables. Note that you + // Assign values to variables. Note that you // do not have to test for null values. idValue = (SqlInt32)row["ID"]; descriptionValue = (SqlString)row["Description"]; diff --git a/samples/snippets/csharp/VS_Snippets_CFX/CFX_ActivityExample/cs/Program.cs b/samples/snippets/csharp/VS_Snippets_CFX/CFX_ActivityExample/cs/Program.cs index fbc1036c3c672..50d4554c14b66 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/CFX_ActivityExample/cs/Program.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/CFX_ActivityExample/cs/Program.cs @@ -66,7 +66,7 @@ static void snippet2() // Output: // Hello World with activity action. - // Handler of: Hello World with activity action. + // Handler of: Hello World with activity action. // } @@ -170,7 +170,7 @@ public WriteLineWithNotification() { this.Implementation = () => new Sequence { - Activities = + Activities = { new WriteLine { @@ -202,7 +202,7 @@ public WriteFillerText() { this.Implementation = () => new Sequence { - Variables = + Variables = { text }, diff --git a/samples/snippets/csharp/VS_Snippets_CFX/CFX_CompensationExample/cs/Program.cs b/samples/snippets/csharp/VS_Snippets_CFX/CFX_CompensationExample/cs/Program.cs index 28bd9cc7097a6..105feac0e969e 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/CFX_CompensationExample/cs/Program.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/CFX_CompensationExample/cs/Program.cs @@ -39,7 +39,7 @@ static void FlightConfirmation() Activity wf = new Sequence() { - Variables = + Variables = { token1 }, @@ -82,7 +82,7 @@ static void ExplicitCompensation() Activity wf = new TryCatch() { - Variables = + Variables = { token1 }, @@ -166,7 +166,7 @@ static void ImplicitCancellation() { Body = new Sequence { - Activities = + Activities = { new ReserveFlight(), new SimulatedErrorCondition() @@ -227,7 +227,7 @@ static void GetXaml(Activity wf, string outXaml) // Create the Xaml for the first file StreamWriter sw = File.CreateText(inFile); - + XamlServices.Save(sw, wf); sw.Close(); diff --git a/samples/snippets/csharp/VS_Snippets_CFX/CFX_WCFDataServicesActivityExample/cs/Program.cs b/samples/snippets/csharp/VS_Snippets_CFX/CFX_WCFDataServicesActivityExample/cs/Program.cs index b1639c6b05d7b..a35707abdbdca 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/CFX_WCFDataServicesActivityExample/cs/Program.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/CFX_WCFDataServicesActivityExample/cs/Program.cs @@ -80,7 +80,7 @@ private static void snippet20() Argument = customer, Handler = new WriteLine { - Text = new InArgument((env) => string.Format("{0}, Contact: {1}", + Text = new InArgument((env) => string.Format("{0}, Contact: {1}", customer.Get(env).CompanyName, customer.Get(env).ContactName)) } } @@ -161,7 +161,7 @@ private static void snippet1() // new WriteLine { - Text = new InArgument(env => string.Format("Raw data returned:\n{0}", data.Get(env))) + Text = new InArgument(env => string.Format("Raw data returned:\n{0}", data.Get(env))) } } }; @@ -194,7 +194,7 @@ protected override IAsyncResult BeginExecute(AsyncCodeActivityContext context, A { NorthwindEntities dataContext = new NorthwindEntities(new Uri(ServiceUri.Get(context))); - // Define a LINQ query that returns Orders and + // Define a LINQ query that returns Orders and // Order_Details for a specific customer. DataServiceQuery ordersQuery = (DataServiceQuery) from o in dataContext.Orders.Expand("Order_Details") diff --git a/samples/snippets/csharp/VS_Snippets_CFX/auditingsecurityevents/cs/auditingsecurityevents.cs b/samples/snippets/csharp/VS_Snippets_CFX/auditingsecurityevents/cs/auditingsecurityevents.cs index 4a847ffc959eb..3281be404a561 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/auditingsecurityevents/cs/auditingsecurityevents.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/auditingsecurityevents/cs/auditingsecurityevents.cs @@ -66,23 +66,23 @@ public static void Main() Uri baseAddress = new Uri(ConfigurationManager. AppSettings["baseAddress"]); - // Create a ServiceHost for the CalculatorService type + // Create a ServiceHost for the CalculatorService type // and provide the base address. - using (ServiceHost serviceHost = new + using (ServiceHost serviceHost = new ServiceHost(typeof(CalculatorService), baseAddress)) { // // // // Create a new auditing behavior and set the log location. - ServiceSecurityAuditBehavior newAudit = + ServiceSecurityAuditBehavior newAudit = new ServiceSecurityAuditBehavior(); - newAudit.AuditLogLocation = + newAudit.AuditLogLocation = AuditLogLocation.Application; // - newAudit.MessageAuthenticationAuditLevel = + newAudit.MessageAuthenticationAuditLevel = AuditLevel.SuccessOrFailure; - newAudit.ServiceAuthorizationAuditLevel = + newAudit.ServiceAuthorizationAuditLevel = AuditLevel.SuccessOrFailure; // newAudit.SuppressAuditFailure = false; @@ -93,7 +93,7 @@ public static void Main() Behaviors.Remove(); serviceHost.Description.Behaviors.Add(newAudit); // - // Open the ServiceHostBase to create listeners + // Open the ServiceHostBase to create listeners // and start listening for messages. serviceHost.Open(); diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_certificatevalidationdifferences/cs/source.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_certificatevalidationdifferences/cs/source.cs index 7eb8878ac0002..1bb569628b4a6 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_certificatevalidationdifferences/cs/source.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_certificatevalidationdifferences/cs/source.cs @@ -58,16 +58,16 @@ public static bool ValidateServerCertificate( } private void CreateServiceHost() - { + { ServiceHost myServiceHost=new ServiceHost(typeof(Calculator)); // myServiceHost.Credentials.ClientCertificate.Authentication. CertificateValidationMode= - X509CertificateValidationMode.PeerOrChainTrust; - + X509CertificateValidationMode.PeerOrChainTrust; + myServiceHost.Credentials.ClientCertificate.Authentication. - RevocationMode=X509RevocationMode.Offline; + RevocationMode=X509RevocationMode.Offline; // } @@ -88,7 +88,7 @@ public interface ICalculator [OperationContract] double Add(double a, double b); } - + public class Calculator:ICalculator { public double Add(double a, double b) diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_collection_types_in_data_contracts/cs/program.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_collection_types_in_data_contracts/cs/program.cs index 2951ace4818c3..1df8dd7351ff4 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_collection_types_in_data_contracts/cs/program.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_collection_types_in_data_contracts/cs/program.cs @@ -98,7 +98,7 @@ public CustomList(T[] items) } } - // This is the generated code. Note that the class is renamed to "CustomBookList", + // This is the generated code. Note that the class is renamed to "CustomBookList", // and the ItemName is set to "CustomItem". [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "3.0.0.0")] [System.Runtime.Serialization.CollectionDataContractAttribute(ItemName = "CustomItem")] @@ -153,7 +153,7 @@ private void Run() myBinding.Security.Message.ClientCredentialType = MessageCredentialType.Windows; - // Create the Type instances for later use and the Uri for + // Create the Type instances for later use and the Uri for // the base address. Type contractType = typeof(ICatalog); Type serviceType = typeof(Catalog); @@ -221,7 +221,7 @@ public class Customer2 // // - [CollectionDataContract] + [CollectionDataContract] public class CustomerList2 : Collection {} // @@ -237,9 +237,9 @@ public class CustomerList4 : Collection {} // [CollectionDataContract - (Name = "CountriesOrRegionsWithCapitals", - ItemName = "entry", - KeyName = "countryorregion", + (Name = "CountriesOrRegionsWithCapitals", + ItemName = "entry", + KeyName = "countryorregion", ValueName = "capital")] public class CountriesOrRegionsWithCapitals2 : Dictionary { } // @@ -271,9 +271,9 @@ public class Payroll } [DataContract] - [KnownType(typeof(List))] + [KnownType(typeof(List))] //required because List is used polymorphically - //does not conflict with ArrayList above because it's a different scope, + //does not conflict with ArrayList above because it's a different scope, //even though it's the same data contract [KnownType(typeof(InHouseTraining))] //Required if InHouseTraining can be used in the collection [KnownType(typeof(OutsideTraining))] //Required if OutsideTraining can be used in the collection diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_configureportsharing/cs/source.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_configureportsharing/cs/source.cs index f3e633766ffa2..79645713d7f9a 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_configureportsharing/cs/source.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_configureportsharing/cs/source.cs @@ -6,13 +6,13 @@ namespace Samples // [ServiceContract] - interface IMyService + interface IMyService { //Define the contract operations. } - class MyService : IMyService + class MyService : IMyService { //Implement the IMyService operations. diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_createsecuresession/cs/secureservice.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_createsecuresession/cs/secureservice.cs index 434ec95014266..e02d1ff0c0118 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_createsecuresession/cs/secureservice.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_createsecuresession/cs/secureservice.cs @@ -30,7 +30,7 @@ private void Run() MessageCredentialType.Windows; // - // Create the Type instances for later use and the URI for + // Create the Type instances for later use and the URI for // the base address. Type contractType = typeof(ICalculator); Type serviceType = typeof(Calculator); @@ -70,7 +70,7 @@ private void Run2() // Create the custom binding. CustomBinding myBinding = new CustomBinding(security, new HttpTransportBindingElement()); - // Create the Type instances for later use and the URI for + // Create the Type instances for later use and the URI for // the base address. Type contractType = typeof(ICalculator); Type serviceType = typeof(Calculator); diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_createstatefulsct/cs/secureservice.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_createstatefulsct/cs/secureservice.cs index e94005f5978c1..6cfcf4bd624f0 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_createstatefulsct/cs/secureservice.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_createstatefulsct/cs/secureservice.cs @@ -26,7 +26,7 @@ private void Run() myBinding.Security.Message.ClientCredentialType = MessageCredentialType.Windows; - // Create the Type instances for later use and the Uri for + // Create the Type instances for later use and the Uri for // the base address. Type contractType = typeof(ICalculator); Type serviceType = typeof(Calculator); @@ -54,13 +54,13 @@ private void Run2() // Use a secure session and specify that stateful SecurityContextToken security tokens are used. security = SecurityBindingElement.CreateSecureConversationBindingElement(security, false); - // Specify whether derived keys are needed. + // Specify whether derived keys are needed. security.SetKeyDerivation(true); // Create the custom binding. CustomBinding myBinding = new CustomBinding(security, new HttpTransportBindingElement()); - // Create the Type instances for later use and the Uri for + // Create the Type instances for later use and the Uri for // the base address. Type contractType = typeof(ICalculator); Type serviceType = typeof(Calculator); diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_creatests/cs/source.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_creatests/cs/source.cs index cd0128dd07028..515393cc2216c 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_creatests/cs/source.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_creatests/cs/source.cs @@ -122,11 +122,11 @@ private void Run() // itcc.LocalIssuerBinding = new WSHttpBinding("LocalIssuerBinding"); - // + // // SynchronousReceiveBehavior myEndpointBehavior = new SynchronousReceiveBehavior(); - // + // itcc.LocalIssuerChannelBehaviors.Add(myEndpointBehavior); // // diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_customauthmgr/cs/c_customauthmgr.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_customauthmgr/cs/c_customauthmgr.cs index 08a13881ae145..1675b9f48077c 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_customauthmgr/cs/c_customauthmgr.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_customauthmgr/cs/c_customauthmgr.cs @@ -16,11 +16,11 @@ public class MyServiceAuthorizationManager : ServiceAuthorizationManager // // protected override bool CheckAccessCore(OperationContext operationContext) - { + { // Extract the action URI from the OperationContext. Match this against the claims // in the AuthorizationContext. string action = operationContext.RequestContext.RequestMessage.Headers.Action; - + // Iterate through the various claim sets in the AuthorizationContext. foreach(ClaimSet cs in operationContext.ServiceSecurityContext.AuthorizationContext.ClaimSets) { @@ -36,9 +36,9 @@ protected override bool CheckAccessCore(OperationContext operationContext) } } } - + // If this point is reached, return false to deny access. - return false; + return false; } // } @@ -72,7 +72,7 @@ public static void Main() { // // Add a custom authorization manager to the service authorization behavior. - serviceHost.Authorization.ServiceAuthorizationManager = + serviceHost.Authorization.ServiceAuthorizationManager = new MyServiceAuthorizationManager(); // // Open the ServiceHost to create listeners and start listening for messages. diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_customauthpol/cs/c_customauthpol.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_customauthpol/cs/c_customauthpol.cs index e9202255f2a67..4ae1ca00d07e1 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_customauthpol/cs/c_customauthpol.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_customauthpol/cs/c_customauthpol.cs @@ -58,7 +58,7 @@ public bool Evaluate(EvaluationContext evaluationContext, ref object state) bool bRet = false; CustomAuthState customstate = null; - // If the state is null, then this has not been called before so + // If the state is null, then this has not been called before so // set up a custom state. if (state == null) { diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_custombinding/cs/c_custombinding.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_custombinding/cs/c_custombinding.cs index 154e23c92c497..208744a84bddb 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_custombinding/cs/c_custombinding.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_custombinding/cs/c_custombinding.cs @@ -31,7 +31,7 @@ private CustomBindingCreator(){} // public static Binding CreateCustomBinding() { - // Create an empty BindingElementCollection to populate, + // Create an empty BindingElementCollection to populate, // then create a custom binding from it. BindingElementCollection outputBec = new BindingElementCollection(); @@ -39,7 +39,7 @@ public static Binding CreateCustomBinding() // // // Create a SymmetricSecurityBindingElement. - SymmetricSecurityBindingElement ssbe = + SymmetricSecurityBindingElement ssbe = new SymmetricSecurityBindingElement(); // @@ -53,7 +53,7 @@ public static Binding CreateCustomBinding() // Use a Kerberos token as the protection token. ssbe.ProtectionTokenParameters = new KerberosSecurityTokenParameters(); // - + // Add the SymmetricSecurityBindingElement to the BindingElementCollection. outputBec.Add ( ssbe ); outputBec.Add(new TextMessageEncodingBindingElement()); @@ -97,7 +97,7 @@ private MultipleTokensBinding() { } public static Binding CreateCustomBinding(EndpointAddress issuerEndpointAddress1, Binding issuerBinding1, EndpointAddress issuerEndpointAddress2, Binding issuerBinding2) { // - // Create an empty BindingElementCollection to populate, + // Create an empty BindingElementCollection to populate, // then create a custom binding from it. BindingElementCollection bec = new BindingElementCollection(); // @@ -109,17 +109,17 @@ public static Binding CreateCustomBinding(EndpointAddress issuerEndpointAddress1 // SupportingTokenParameters supportParams = new SupportingTokenParameters(); // - + // // Two supporting SAML tokens are being added. supportParams.SignedEndorsing.Add(new IssuedSecurityTokenParameters("samlTokenType", issuerEndpointAddress1, issuerBinding1)); supportParams.SignedEndorsing.Add(new IssuedSecurityTokenParameters("samlTokenType", issuerEndpointAddress2, issuerBinding2)); // - + // ((SymmetricSecurityBindingElement)sbe).OperationSupportingTokenParameters.Add("*", supportParams); // - + // bec.Add(sbe); bec.Add(new TextMessageEncodingBindingElement()); diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_custombindingsauthmode/cs/source.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_custombindingsauthmode/cs/source.cs index 5d7b542da3856..7cd22cd0daaf9 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_custombindingsauthmode/cs/source.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_custombindingsauthmode/cs/source.cs @@ -18,8 +18,8 @@ public sealed class CustomBindingCreator private CustomBindingCreator() { } // - // These public methods create custom bindings based on the built-in - // authentication modes that use the static methods of + // These public methods create custom bindings based on the built-in + // authentication modes that use the static methods of // the System.ServiceModel.Channels.SecurityBindingElement class. public static Binding CreateAnonymousForCertificateBinding() { @@ -228,19 +228,19 @@ public static Binding CreateCustomBinding() // // - BindingElementCollection outputBindings = + BindingElementCollection outputBindings = new BindingElementCollection(); // - + // b.DefaultAlgorithmSuite = SecurityAlgorithmSuite.Basic128; - b.MessageProtectionOrder = + b.MessageProtectionOrder = MessageProtectionOrder.SignBeforeEncrypt; - b.ProtectionTokenParameters = + b.ProtectionTokenParameters = new KerberosSecurityTokenParameters(); // // - + // outputBindings.Add(b); outputBindings.Add(new TextMessageEncodingBindingElement()); diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_customcertificatevalidator/cs/source.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_customcertificatevalidator/cs/source.cs index dbf5ef42ef639..0c8475c9f52f9 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_customcertificatevalidator/cs/source.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_customcertificatevalidator/cs/source.cs @@ -11,7 +11,7 @@ [assembly: SecurityPermission( SecurityAction.RequestMinimum, Execution = true)] namespace Microsoft.ServiceModel.Samples -{ +{ [ServiceContract(Namespace="http://Microsoft.ServiceModel.Samples")] public interface ICalculator { @@ -35,9 +35,9 @@ static void Main() using (ServiceHost serviceHost = new ServiceHost(typeof(CalculatorService))) { // - serviceHost.Credentials.ClientCertificate.Authentication.CertificateValidationMode = + serviceHost.Credentials.ClientCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.Custom; - serviceHost.Credentials.ClientCertificate.Authentication.CustomCertificateValidator = + serviceHost.Credentials.ClientCertificate.Authentication.CustomCertificateValidator = new MyX509CertificateValidator("CN=Contoso.com"); // diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_customclaim/cs/c_customclaim.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_customclaim/cs/c_customclaim.cs index 2edd9d2f0bc09..238faf35e6eba 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_customclaim/cs/c_customclaim.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_customclaim/cs/c_customclaim.cs @@ -33,7 +33,7 @@ public MyResourceType(string text, int number ) public string Text { get { return this.text; } set { this.text = value; } } [DataMember] public int Number { get { return this.number; } set { this.number = value; } } - } + } // class Program diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_customclaimcomparison/cs/c_customclaimcomparison.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_customclaimcomparison/cs/c_customclaimcomparison.cs index 07ca7a6b51b2e..476ca3a5e4e1e 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_customclaimcomparison/cs/c_customclaimcomparison.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_customclaimcomparison/cs/c_customclaimcomparison.cs @@ -48,7 +48,7 @@ public override bool Equals(Object obj) // into an instance of MyResourceType MyResourceType rhs = obj as MyResourceType; - // If the object we're being asked to compare ourselves to + // If the object we're being asked to compare ourselves to // isn't an instance of MyResourceType then return false if (rhs == null) return false; @@ -136,9 +136,9 @@ private bool TestClaim2(object obj) { // if (ReferenceEquals(this, obj)) return true; - // + // else return true; } - } + } } diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_customcredentials/cs/source.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_customcredentials/cs/source.cs index 41a92a93b436a..487972ab7dbf3 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_customcredentials/cs/source.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_customcredentials/cs/source.cs @@ -9,7 +9,7 @@ using System.ServiceModel.Configuration; using System.Configuration; -[assembly: SecurityPermission(SecurityAction.RequestMinimum, +[assembly: SecurityPermission(SecurityAction.RequestMinimum, Execution = true)] namespace Microsoft.ServiceModel.Samples { @@ -61,7 +61,7 @@ protected override ClientCredentials CloneCore() // // - internal class MyClientCredentialsSecurityTokenManager : + internal class MyClientCredentialsSecurityTokenManager : ClientCredentialsSecurityTokenManager { MyClientCredentials credentials; @@ -141,7 +141,7 @@ protected override ServiceCredentials CloneCore() // // - internal class MyServiceCredentialsSecurityTokenManager : + internal class MyServiceCredentialsSecurityTokenManager : ServiceCredentialsSecurityTokenManager { MyServiceCredentials credentials; @@ -206,11 +206,11 @@ protected override ConfigurationPropertyCollection Properties { ConfigurationPropertyCollection properties = base.Properties; properties.Add(new ConfigurationProperty( - "creditCardNumber", - typeof(System.String), + "creditCardNumber", + typeof(System.String), string.Empty, - null, - new StringValidator(0, 32, null), + null, + new StringValidator(0, 32, null), ConfigurationPropertyOptions.None)); this.properties = properties; } @@ -294,37 +294,37 @@ public string Echo(string value) } public partial class CalculatorClient : System.ServiceModel.ClientBase, ICalculator { - + public CalculatorClient() { } - - public CalculatorClient(string endpointConfigurationName) : + + public CalculatorClient(string endpointConfigurationName) : base(endpointConfigurationName) { } - - public CalculatorClient(string endpointConfigurationName, string remoteAddress) : + + public CalculatorClient(string endpointConfigurationName, string remoteAddress) : base(endpointConfigurationName, remoteAddress) { } - - public CalculatorClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : + + public CalculatorClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : base(endpointConfigurationName, remoteAddress) { } - - public CalculatorClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : + + public CalculatorClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : base(binding, remoteAddress) { } - + public double Add(double a, double b) { return base.Channel.Add(a, b); } } - + [System.ServiceModel.ServiceContractAttribute(ConfigurationName = "ICalculator")] public interface ICalculator { diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_customfederationbinding/cs/c_customfederationbinding.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_customfederationbinding/cs/c_customfederationbinding.cs index 2cbfa81d98787..d84710f8eccca 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_customfederationbinding/cs/c_customfederationbinding.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_customfederationbinding/cs/c_customfederationbinding.cs @@ -11,7 +11,7 @@ SecurityAction.RequestMinimum, Execution = true)] namespace Samples { - + public sealed class CustomBindingCreator { // @@ -46,11 +46,11 @@ public static CustomBinding CreateFederationBindingWithoutSecureSession(WSFedera return outputBinding; } // - // It is a good practice to create a private constructor for a class that only + // It is a good practice to create a private constructor for a class that only // defines static methods. private CustomBindingCreator() { } - static void Main() - { + static void Main() + { // Code not shown. } } diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_customtoken/cs/source.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_customtoken/cs/source.cs index d11f5d69307a5..904cab1da330a 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_customtoken/cs/source.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_customtoken/cs/source.cs @@ -95,29 +95,29 @@ public CreditCardToken(CreditCardInfo cardInfo, string id) this.securityKeys = new ReadOnlyCollection(new List()); } - public CreditCardInfo CardInfo - { - get { return this.cardInfo; } + public CreditCardInfo CardInfo + { + get { return this.cardInfo; } } - public override ReadOnlyCollection SecurityKeys - { - get { return this.securityKeys; } + public override ReadOnlyCollection SecurityKeys + { + get { return this.securityKeys; } } - public override DateTime ValidFrom - { - get { return this.effectiveTime; } + public override DateTime ValidFrom + { + get { return this.effectiveTime; } } - public override DateTime ValidTo - { - get { return this.cardInfo.ExpirationDate; } + public override DateTime ValidTo + { + get { return this.cardInfo.ExpirationDate; } } - - public override string Id - { - get { return this.id; } + + public override string Id + { + get { return this.id; } } } // @@ -146,24 +146,24 @@ protected override void InitializeSecurityTokenRequirement(SecurityTokenRequirem } // A credit card token has no cryptography, no windows identity, and supports only client authentication. - protected override bool HasAsymmetricKey - { - get { return false; } + protected override bool HasAsymmetricKey + { + get { return false; } } - - protected override bool SupportsClientAuthentication - { - get { return true; } + + protected override bool SupportsClientAuthentication + { + get { return true; } } - - protected override bool SupportsClientWindowsIdentity - { - get { return false; } + + protected override bool SupportsClientWindowsIdentity + { + get { return false; } } - - protected override bool SupportsServerAuthentication - { - get { return false; } + + protected override bool SupportsServerAuthentication + { + get { return false; } } protected override SecurityKeyIdentifierClause CreateKeyIdentifierClause(SecurityToken token, SecurityTokenReferenceStyle referenceStyle) @@ -246,13 +246,13 @@ protected override bool CanWriteTokenCore(SecurityToken token) protected override void WriteTokenCore(XmlWriter writer, SecurityToken token) { - if (writer == null) - { - throw new ArgumentNullException("writer"); + if (writer == null) + { + throw new ArgumentNullException("writer"); } - if (token == null) - { - throw new ArgumentNullException("token"); + if (token == null) + { + throw new ArgumentNullException("token"); } CreditCardToken c = token as CreditCardToken; @@ -437,7 +437,7 @@ public override SecurityTokenSerializer CreateSecurityTokenSerializer(SecurityTo } } // - + // public class CreditCardServiceCredentialsSecurityTokenManager : ServiceCredentialsSecurityTokenManager { @@ -531,7 +531,7 @@ public override SecurityTokenManager CreateSecurityTokenManager() } } // - + // public static class BindingHelper { @@ -540,7 +540,7 @@ public static Binding CreateCreditCardBinding() HttpTransportBindingElement httpTransport = new HttpTransportBindingElement(); // The message security binding element is configured to require a credit card - // token that is encrypted with the service's certificate. + // token that is encrypted with the service's certificate. SymmetricSecurityBindingElement messageSecurity = new SymmetricSecurityBindingElement(); messageSecurity.EndpointSupportingTokenParameters.SignedEncrypted.Add(new CreditCardTokenParameters()); X509SecurityTokenParameters x509ProtectionParameters = new X509SecurityTokenParameters(); diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_customtokenauthenticator/cs/source.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_customtokenauthenticator/cs/source.cs index 2ad8adced80aa..15333785bce98 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_customtokenauthenticator/cs/source.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_customtokenauthenticator/cs/source.cs @@ -20,17 +20,17 @@ internal class MySecurityTokenAuthenticator : SecurityTokenAuthenticator { protected override bool CanValidateTokenCore(SecurityToken token) { - // Check that the incoming token is a username token type that + // Check that the incoming token is a username token type that // can be validated by this implementation. return (token is UserNameSecurityToken); } - protected override ReadOnlyCollection + protected override ReadOnlyCollection ValidateTokenCore(SecurityToken token) { UserNameSecurityToken userNameToken = token as UserNameSecurityToken; - // Validate the information contained in the username token. For demonstration + // Validate the information contained in the username token. For demonstration // purposes, this code just checks that the user name matches the password. if (userNameToken.UserName != userNameToken.Password) { @@ -39,7 +39,7 @@ protected override ReadOnlyCollection // Create just one Claim instance for the username token - the name of the user. DefaultClaimSet userNameClaimSet = new DefaultClaimSet( - ClaimSet.System, + ClaimSet.System, new Claim(ClaimTypes.Name, userNameToken.UserName, Rights.PossessProperty)); List policies = new List(1); policies.Add(new MyAuthorizationPolicy(userNameClaimSet)); @@ -49,7 +49,7 @@ protected override ReadOnlyCollection // // - internal class MyServiceCredentialsSecurityTokenManager : + internal class MyServiceCredentialsSecurityTokenManager : ServiceCredentialsSecurityTokenManager { ServiceCredentials credentials; @@ -62,7 +62,7 @@ public MyServiceCredentialsSecurityTokenManager(ServiceCredentials credentials) public override SecurityTokenAuthenticator CreateSecurityTokenAuthenticator (SecurityTokenRequirement tokenRequirement, out SecurityTokenResolver outOfBandTokenResolver) { - // Return your implementation of the SecurityTokenProvider based on the + // Return your implementation of the SecurityTokenProvider based on the // tokenRequirement argument. SecurityTokenAuthenticator result; if (tokenRequirement.TokenType == SecurityTokenTypes.UserName) diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_customtokenprovider/cs/source.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_customtokenprovider/cs/source.cs index 758b79595587b..bcb64de641737 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_customtokenprovider/cs/source.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_customtokenprovider/cs/source.cs @@ -42,7 +42,7 @@ public MyClientCredentialsSecurityTokenManager(ClientCredentials credentials) public override SecurityTokenProvider CreateSecurityTokenProvider( SecurityTokenRequirement tokenRequirement) { - // Return your implementation of the SecurityTokenProvider based on the + // Return your implementation of the SecurityTokenProvider based on the // tokenRequirement argument. SecurityTokenProvider result; if (tokenRequirement.TokenType == SecurityTokenTypes.X509Certificate) diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_customusernameandpasswordvalidator/cs/service.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_customusernameandpasswordvalidator/cs/service.cs index ebf3537f4b438..7d6aa325f6fd3 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_customusernameandpasswordvalidator/cs/service.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_customusernameandpasswordvalidator/cs/service.cs @@ -68,9 +68,9 @@ public class CustomUserNameValidator : UserNamePasswordValidator { // // - // This method validates users. It allows in two users, test1 and test2 + // This method validates users. It allows in two users, test1 and test2 // with passwords 1tset and 2tset respectively. - // This code is for illustration purposes only and + // This code is for illustration purposes only and // must not be used in a production environment because it is not secure. public override void Validate(string userName, string password) { diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_datacontract/cs/source.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_datacontract/cs/source.cs index 0f244cd9a0479..c773820628a40 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_datacontract/cs/source.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_datacontract/cs/source.cs @@ -11,17 +11,17 @@ namespace Example [ServiceContract] public interface ISampleInterface { - // No data contract is required since both the parameter + // No data contract is required since both the parameter // and return types are primitive types. [OperationContract] double SquareRoot(int root); - // No Data Contract required because both parameter and return + // No Data Contract required because both parameter and return // types are marked with the SerializableAttribute attribute. [OperationContract] System.Drawing.Bitmap GetPicture(System.Uri pictureUri); - // The MyTypes.PurchaseOrder is a complex type, and thus + // The MyTypes.PurchaseOrder is a complex type, and thus // requires a data contract. [OperationContract] bool ApprovePurchaseOrder(MyTypes.PurchaseOrder po); @@ -165,7 +165,7 @@ public virtual ExtensionDataObject ExtensionData namespace VersionTolerantCallback { // - // The following Data Contract is version 2 of an earlier data + // The following Data Contract is version 2 of an earlier data // contract. [DataContract] public class Address @@ -176,14 +176,14 @@ public class Address [DataMember] public string State; - // This data member was added in version 2, and thus may be missing - // in the incoming data if the data conforms to version 1 of the + // This data member was added in version 2, and thus may be missing + // in the incoming data if the data conforms to version 1 of the // Data Contract. Use the callback to add a default for this case. [DataMember(Order=2)] public string CountryRegion; // This method is used as a kind of constructor to initialize - // a default value for the CountryRegion data member before + // a default value for the CountryRegion data member before // deserialization. [OnDeserializing] private void setDefaultCountryRegion(StreamingContext c) diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_datacontractnames/cs/source.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_datacontractnames/cs/source.cs index 1541225669026..6a1c846c0275a 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_datacontractnames/cs/source.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_datacontractnames/cs/source.cs @@ -2,13 +2,13 @@ using System.Runtime.Serialization; // -// This overrides the standard namespace mapping for all contracts -// in Contoso.CRM. +// This overrides the standard namespace mapping for all contracts +// in Contoso.CRM. [assembly: ContractNamespace("http://schemas.example.com/crm", ClrNamespace = "Contoso.CRM")] namespace Contoso.CRM { - // The namespace is overridden to become: + // The namespace is overridden to become: // http://schemas.example.com/crm. // But the name is the default "Customer". [DataContract] @@ -39,7 +39,7 @@ public class MyInvoice // Code not shown. } - // The contract name is "Payment" instead of "MyPayment" + // The contract name is "Payment" instead of "MyPayment" // and the Namespace is "http://schemas.example.com" instead // of the default. [DataContract(Name = "Payment", @@ -99,7 +99,7 @@ static void Main() namespace DataMemberOrder { - // + // [DataContract] public class BaseType { @@ -169,7 +169,7 @@ public class Coords2 public int Y; [DataMember] public int X; - // Order is alphabetical (X,Y), equivalent + // Order is alphabetical (X,Y), equivalent // to the preceding code. } @@ -180,7 +180,7 @@ public class Coords3 public int Y; [DataMember(Order = 1)] public int X; - // Order is according to the Order property (X,Y), + // Order is according to the Order property (X,Y), // equivalent to the preceding code. } // @@ -193,7 +193,7 @@ public class Coords4 public int Y; [DataMember(Order = 2)] public int X; - // Order is according to the Order property (Y,X), + // Order is according to the Order property (Y,X), // different from the preceding code. } // @@ -218,7 +218,7 @@ public class Employee : Person [DataMember] public int salary; } - // Order is "name", "department", "salary", "title" + // Order is "name", "department", "salary", "title" // (base class first, then alphabetical). [DataContract(Name = "Employee")] @@ -233,8 +233,8 @@ public class Worker [DataMember(Order = 2)] public int salary; } - // Order is "name", "department", "salary", "title" - // (Order=1 first, then Order=2 in alphabetical order), + // Order is "name", "department", "salary", "title" + // (Order=1 first, then Order=2 in alphabetical order), // which is equivalent to the Employee order}. // } \ No newline at end of file diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_datacontractversioning/cs/source.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_datacontractversioning/cs/source.cs index 1f9857f78bc4c..df2a157288941 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_datacontractversioning/cs/source.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_datacontractversioning/cs/source.cs @@ -21,7 +21,7 @@ public class Person namespace DataContracts { // - // Version 2. This is a non-breaking change because the data contract + // Version 2. This is a non-breaking change because the data contract // has not changed, even though the type has. [DataContract] public class Person diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_debuggingwindowsauth/cs/source.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_debuggingwindowsauth/cs/source.cs index a55db751f2661..7b4d456fb8bfd 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_debuggingwindowsauth/cs/source.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_debuggingwindowsauth/cs/source.cs @@ -10,7 +10,7 @@ public class Test static void Main() { Service s = new Service(); - s.Nego(); + s.Nego(); } } @@ -20,7 +20,7 @@ internal void Nego() { // WSHttpBinding b = new WSHttpBinding(); - // By default, the WSHttpBinding uses Windows authentication + // By default, the WSHttpBinding uses Windows authentication // and Message mode. b.Security.Message.NegotiateServiceCredential = false; // @@ -48,7 +48,7 @@ private void IncorrectReturn() { // CalculatorClient cc = new - CalculatorClient("WSHttpBinding_ICalculator"); + CalculatorClient("WSHttpBinding_ICalculator"); cc.ClientCredentials.UserName.UserName = GetUserName(); // wrong! cc.ClientCredentials.UserName.Password = GetPassword(); // wrong! // @@ -57,9 +57,9 @@ private void IncorrectReturn() private void CorrectReturn() { // - CalculatorClient cc = new + CalculatorClient cc = new CalculatorClient("WSHttpBinding_ICalculator"); - // This code returns the WindowsClientCredential type. + // This code returns the WindowsClientCredential type. cc.ClientCredentials.Windows.ClientCredential.UserName = GetUserName(); cc.ClientCredentials.Windows.ClientCredential.Password = GetPassword(); // @@ -68,7 +68,7 @@ private void CorrectReturn() private void DisallowNTLM() { // - CalculatorClient cc = new + CalculatorClient cc = new CalculatorClient("WSHttpBinding_ICalculator"); cc.ClientCredentials.Windows.AllowNtlm = false; // diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_duplexservices/cs/generatedclient.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_duplexservices/cs/generatedclient.cs index 0c766168d3a9c..e06e72cbc1cc9 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_duplexservices/cs/generatedclient.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_duplexservices/cs/generatedclient.cs @@ -11,95 +11,95 @@ namespace Microsoft.ServiceModel.Samples { - - + + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")] [System.ServiceModel.ServiceContractAttribute(Namespace="http://Microsoft.ServiceModel.Samples", ConfigurationName="Microsoft.ServiceModel.Samples.ICalculatorDuplex", CallbackContract=typeof(Microsoft.ServiceModel.Samples.ICalculatorDuplexCallback), SessionMode=System.ServiceModel.SessionMode.Required)] public interface ICalculatorDuplex { - + [System.ServiceModel.OperationContractAttribute(IsOneWay=true, Action="http://Microsoft.ServiceModel.Samples/ICalculatorDuplex/Clear")] void Clear(); - + [System.ServiceModel.OperationContractAttribute(IsOneWay=true, Action="http://Microsoft.ServiceModel.Samples/ICalculatorDuplex/AddTo")] void AddTo(double n); - + [System.ServiceModel.OperationContractAttribute(IsOneWay=true, Action="http://Microsoft.ServiceModel.Samples/ICalculatorDuplex/SubtractFrom")] void SubtractFrom(double n); - + [System.ServiceModel.OperationContractAttribute(IsOneWay=true, Action="http://Microsoft.ServiceModel.Samples/ICalculatorDuplex/MultiplyBy")] void MultiplyBy(double n); - + [System.ServiceModel.OperationContractAttribute(IsOneWay=true, Action="http://Microsoft.ServiceModel.Samples/ICalculatorDuplex/DivideBy")] void DivideBy(double n); } - + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")] public interface ICalculatorDuplexCallback { - + [System.ServiceModel.OperationContractAttribute(IsOneWay=true, Action="http://Microsoft.ServiceModel.Samples/ICalculatorDuplex/Equals")] void Equals(double result); - + [System.ServiceModel.OperationContractAttribute(IsOneWay=true, Action="http://Microsoft.ServiceModel.Samples/ICalculatorDuplex/Equation")] void Equation(string eqn); } - + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")] public interface ICalculatorDuplexChannel : Microsoft.ServiceModel.Samples.ICalculatorDuplex, System.ServiceModel.IClientChannel { } - + [System.Diagnostics.DebuggerStepThroughAttribute()] [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")] public partial class CalculatorDuplexClient : System.ServiceModel.DuplexClientBase, Microsoft.ServiceModel.Samples.ICalculatorDuplex { - - public CalculatorDuplexClient(System.ServiceModel.InstanceContext callbackInstance) : + + public CalculatorDuplexClient(System.ServiceModel.InstanceContext callbackInstance) : base(callbackInstance) { } - - public CalculatorDuplexClient(System.ServiceModel.InstanceContext callbackInstance, string endpointConfigurationName) : + + public CalculatorDuplexClient(System.ServiceModel.InstanceContext callbackInstance, string endpointConfigurationName) : base(callbackInstance, endpointConfigurationName) { } - - public CalculatorDuplexClient(System.ServiceModel.InstanceContext callbackInstance, string endpointConfigurationName, string remoteAddress) : + + public CalculatorDuplexClient(System.ServiceModel.InstanceContext callbackInstance, string endpointConfigurationName, string remoteAddress) : base(callbackInstance, endpointConfigurationName, remoteAddress) { } - - public CalculatorDuplexClient(System.ServiceModel.InstanceContext callbackInstance, string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : + + public CalculatorDuplexClient(System.ServiceModel.InstanceContext callbackInstance, string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : base(callbackInstance, endpointConfigurationName, remoteAddress) { } - - public CalculatorDuplexClient(System.ServiceModel.InstanceContext callbackInstance, System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : + + public CalculatorDuplexClient(System.ServiceModel.InstanceContext callbackInstance, System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : base(callbackInstance, binding, remoteAddress) { } - + public void Clear() { base.Channel.Clear(); } - + public void AddTo(double n) { base.Channel.AddTo(n); } - + public void SubtractFrom(double n) { base.Channel.SubtractFrom(n); } - + public void MultiplyBy(double n) { base.Channel.MultiplyBy(n); } - + public void DivideBy(double n) { base.Channel.DivideBy(n); diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_federatedclient/cs/source.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_federatedclient/cs/source.cs index 4d6c3aec137c9..327646763ffe4 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_federatedclient/cs/source.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_federatedclient/cs/source.cs @@ -42,7 +42,7 @@ SecurityKeyEntropyMode entropyMode // - // It is a good practice to create a private constructor for a class that only + // It is a good practice to create a private constructor for a class that only // defines static methods. private IssuedTokenClientCredentialsConfiguration() { } } diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_federatedservice/cs/source.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_federatedservice/cs/source.cs index d3c47f1a7a45f..419b1349ca88b 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_federatedservice/cs/source.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_federatedservice/cs/source.cs @@ -35,19 +35,19 @@ public sealed class IssuedTokenServiceCredentialsConfiguration { // // This method configures the IssuedTokenAuthentication property of a ServiceHost. - public static void ConfigureIssuedTokenServiceCredentials( - ServiceHost sh, bool allowCardspaceTokens, IList knownissuers, + public static void ConfigureIssuedTokenServiceCredentials( + ServiceHost sh, bool allowCardspaceTokens, IList knownissuers, X509CertificateValidationMode certMode, X509RevocationMode revocationMode, SamlSerializer ser ) { // Allow CardSpace tokens. sh.Credentials.IssuedTokenAuthentication.AllowUntrustedRsaIssuers = allowCardspaceTokens; - + // Set up known issuer certificates. foreach(X509Certificate2 cert in knownissuers) sh.Credentials.IssuedTokenAuthentication.KnownCertificates.Add ( cert ); // Set issuer certificate validation and revocation checking modes. - sh.Credentials.IssuedTokenAuthentication.CertificateValidationMode = + sh.Credentials.IssuedTokenAuthentication.CertificateValidationMode = X509CertificateValidationMode.PeerOrChainTrust; sh.Credentials.IssuedTokenAuthentication.RevocationMode = X509RevocationMode.Online; sh.Credentials.IssuedTokenAuthentication.TrustedStoreLocation = StoreLocation.LocalMachine; @@ -58,7 +58,7 @@ public static void ConfigureIssuedTokenServiceCredentials( } // - // It is a good practice to create a private constructor for a class that only + // It is a good practice to create a private constructor for a class that only // defines static methods. private IssuedTokenServiceCredentialsConfiguration() { } } diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_federation/cs/source.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_federation/cs/source.cs index 54a2b2fdfc89b..6d3986f82e8f9 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_federation/cs/source.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_federation/cs/source.cs @@ -53,9 +53,9 @@ public override bool CheckAccess(OperationContext operationContext) } } - // This helper method checks whether SAML Token was issued by STS-B. - // It compares the Thumbprint Claim of the Issuer against the - // Certificate of STS-B. + // This helper method checks whether SAML Token was issued by STS-B. + // It compares the Thumbprint Claim of the Issuer against the + // Certificate of STS-B. private bool IssuedBySTS_B(ClaimSet myClaimSet) { ClaimSet issuerClaimSet = myClaimSet.Issuer; @@ -66,8 +66,8 @@ private bool IssuedBySTS_B(ClaimSet myClaimSet) return false; if (issuerClaim.Resource == null) return false; byte[] claimThumbprint = (byte[])issuerClaim.Resource; - // It is assumed that stsB_Certificate is a variable of type - // X509Certificate2 that is initialized with the Certificate of + // It is assumed that stsB_Certificate is a variable of type + // X509Certificate2 that is initialized with the Certificate of // STS-B. X509Certificate2 stsB_Certificate = GetStsBCertificate(); byte[] certThumbprint = stsB_Certificate.GetCertHash(); @@ -94,7 +94,7 @@ private void ProcessSamlSecurityToken() string samlSubjectNameFormat = "4"; string samlSubjectEmailAddress = "5"; - // + // // Create the list of SAML Attributes. List samlAttributes = new List(); // Add the userAuthenticated claim. @@ -103,7 +103,7 @@ private void ProcessSamlSecurityToken() SamlAttribute mySamlAttribute = new SamlAttribute("http://www.tmpuri.org", "userAuthenticated", strList); samlAttributes.Add(mySamlAttribute); - // Create the SAML token with the userAuthenticated claim. It is assumed that + // Create the SAML token with the userAuthenticated claim. It is assumed that // the method CreateSamlToken() is implemented as part of STS-A. SamlSecurityToken samlToken = CreateSamlToken( proofToken, @@ -112,7 +112,7 @@ private void ProcessSamlSecurityToken() samlSubjectNameFormat, samlSubjectEmailAddress, samlAttributes); - // + // } private SamlSecurityToken CreateSamlToken(string proofToken, string issuerToken, string samlConditions, string samlSubjectNameFormat, string samlSubjectEmailAddress, @@ -151,8 +151,8 @@ public override bool CheckAccess(OperationContext operationContext) } } - // This helper method checks whether SAML Token was issued by STS-A. - // It compares the Thumbprint Claim of the Issuer against the + // This helper method checks whether SAML Token was issued by STS-A. + // It compares the Thumbprint Claim of the Issuer against the // Certificate of STS-A. private bool IssuedBySTS_A(ClaimSet myClaimSet) { @@ -201,7 +201,7 @@ public SamlSecurityToken ReturnSamlSecurityToken() "accessAuthorized", strList)); - // Create the SAML token with the accessAuthorized claim. It is assumed that + // Create the SAML token with the accessAuthorized claim. It is assumed that // the method CreateSamlToken() is implemented as part of STS-B. SamlSecurityToken samlToken = CreateSamlToken( proofToken, @@ -250,7 +250,7 @@ public override bool CheckAccess(OperationContext operationContext) } } - // This helper method performs a rudimentary check for whether + // This helper method performs a rudimentary check for whether //a given email is valid. private static bool IsValidEmailAddress(string emailAddress) { diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_federationbinding/cs/source.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_federationbinding/cs/source.cs index d2f29a9bdaf05..56c66776bb950 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_federationbinding/cs/source.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_federationbinding/cs/source.cs @@ -18,7 +18,7 @@ public sealed class CustomBindingCreator { // // This method creates a WSFederationHttpBinding. - public static WSFederationHttpBinding + public static WSFederationHttpBinding CreateWSFederationHttpBinding(bool isClient) { // Create an instance of the WSFederationHttpBinding. @@ -26,7 +26,7 @@ public static WSFederationHttpBinding // Set the security mode to Message. b.Security.Mode = WSFederationHttpSecurityMode.Message; - + // Set the Algorithm Suite to Basic256Rsa15. b.Security.Message.AlgorithmSuite = SecurityAlgorithmSuite.Basic256Rsa15; @@ -37,25 +37,25 @@ public static WSFederationHttpBinding b.Security.Message.IssuedKeyType = SecurityKeyType.SymmetricKey; // Set IssuedTokenType to SAML 1.1 - b.Security.Message.IssuedTokenType = + b.Security.Message.IssuedTokenType = "http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#samlv1.1"; - + // Extract the STS certificate from the certificate store. X509Store store = new X509Store(StoreName.TrustedPeople, StoreLocation.CurrentUser); store.Open(OpenFlags.ReadOnly); X509Certificate2Collection certs = store.Certificates.Find( X509FindType.FindByThumbprint, "0000000000000000000000000000000000000000", false); store.Close(); - + // Create an EndpointIdentity from the STS certificate. EndpointIdentity identity = EndpointIdentity.CreateX509CertificateIdentity ( certs[0] ); - - // Set the IssuerAddress using the address of the STS and the previously created + + // Set the IssuerAddress using the address of the STS and the previously created // EndpointIdentity. - b.Security.Message.IssuerAddress = + b.Security.Message.IssuerAddress = new EndpointAddress(new Uri("http://localhost:8000/sts/x509"), identity); - // Set the IssuerBinding to a WSHttpBinding loaded from configuration. + // Set the IssuerBinding to a WSHttpBinding loaded from configuration. // The IssuerBinding is only used on federated clients. if (isClient) { @@ -63,7 +63,7 @@ public static WSFederationHttpBinding } // Set the IssuerMetadataAddress using the metadata address of the STS and the - // previously created EndpointIdentity. The IssuerMetadataAddress is only used + // previously created EndpointIdentity. The IssuerMetadataAddress is only used // on federated services. else { @@ -71,18 +71,18 @@ public static WSFederationHttpBinding new EndpointAddress(new Uri("http://localhost:8001/sts/mex"), identity); } // Create a ClaimTypeRequirement. - ClaimTypeRequirement ctr = new ClaimTypeRequirement + ClaimTypeRequirement ctr = new ClaimTypeRequirement ("http://example.org/claim/c1", false); // Add the ClaimTypeRequirement to ClaimTypeRequirements b.Security.Message.ClaimTypeRequirements.Add(ctr); - + // Return the created binding return b; } // - // It is a good practice to create a private constructor for a class that only + // It is a good practice to create a private constructor for a class that only // defines static methods. private CustomBindingCreator() { } } diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_findclaimsperf/cs/c_findclaimsperf.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_findclaimsperf/cs/c_findclaimsperf.cs index bc22a1253ea85..6322114fd82be 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_findclaimsperf/cs/c_findclaimsperf.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_findclaimsperf/cs/c_findclaimsperf.cs @@ -17,7 +17,7 @@ public static void Main() } // - // The FindSomeClaims method looks in the provided ClaimSet for Claims of the specified type and right. + // The FindSomeClaims method looks in the provided ClaimSet for Claims of the specified type and right. // It returns such Claims in a list. public static IList FindSomeClaims ( ClaimSet cs, string type, string right ) { diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_fourcerts/cs/source.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_fourcerts/cs/source.cs index 9b96465d71f9d..8cf4b128f4a69 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_fourcerts/cs/source.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_fourcerts/cs/source.cs @@ -97,7 +97,7 @@ protected override ClientCredentials CloneCore() // // - internal class MyClientCredentialsSecurityTokenManager : + internal class MyClientCredentialsSecurityTokenManager : ClientCredentialsSecurityTokenManager { MyClientCredentials credentials; @@ -152,16 +152,16 @@ public override SecurityTokenProvider CreateSecurityTokenProvider( return result; } - public override SecurityTokenAuthenticator - CreateSecurityTokenAuthenticator(SecurityTokenRequirement + public override SecurityTokenAuthenticator + CreateSecurityTokenAuthenticator(SecurityTokenRequirement tokenRequirement, out SecurityTokenResolver outOfBandTokenResolver) { - return base.CreateSecurityTokenAuthenticator(tokenRequirement, + return base.CreateSecurityTokenAuthenticator(tokenRequirement, out outOfBandTokenResolver); } } // - + // public class MyServiceCredentials : ServiceCredentials { @@ -244,7 +244,7 @@ protected override ServiceCredentials CloneCore() // // - internal class MyServiceCredentialsSecurityTokenManager : + internal class MyServiceCredentialsSecurityTokenManager : ServiceCredentialsSecurityTokenManager { MyServiceCredentials credentials; @@ -318,31 +318,31 @@ public class Client static void Main(string[] args) { // - EndpointAddress serviceEndpoint = + EndpointAddress serviceEndpoint = new EndpointAddress(new Uri("http://localhost:6060/service")); CustomBinding binding = new CustomBinding(); - AsymmetricSecurityBindingElement securityBE = + AsymmetricSecurityBindingElement securityBE = SecurityBindingElement.CreateMutualCertificateDuplexBindingElement( MessageSecurityVersion. WSSecurity10WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10); - // Add a custom IdentityVerifier because the service uses two certificates - // (one for signing and one for encryption) and an endpoint identity that + // Add a custom IdentityVerifier because the service uses two certificates + // (one for signing and one for encryption) and an endpoint identity that // contains a single identity claim. securityBE.LocalClientSettings.IdentityVerifier = new MyIdentityVerifier(); binding.Elements.Add(securityBE); - CompositeDuplexBindingElement compositeDuplex = + CompositeDuplexBindingElement compositeDuplex = new CompositeDuplexBindingElement(); compositeDuplex.ClientBaseAddress = new Uri("http://localhost:6061/client"); binding.Elements.Add(compositeDuplex); binding.Elements.Add(new OneWayBindingElement()); - + binding.Elements.Add(new HttpTransportBindingElement()); - - using (ChannelFactory factory = + + using (ChannelFactory factory = new ChannelFactory(binding, serviceEndpoint)) { MyClientCredentials credentials = new MyClientCredentials(); @@ -372,7 +372,7 @@ public MyIdentityVerifier() this.defaultVerifier = IdentityVerifier.CreateDefault(); } - public override bool CheckAccess(EndpointIdentity identity, + public override bool CheckAccess(EndpointIdentity identity, AuthorizationContext authContext) { // The following implementation is for demonstration only, and @@ -381,7 +381,7 @@ public override bool CheckAccess(EndpointIdentity identity, return true; } - public override bool TryGetIdentity(EndpointAddress reference, + public override bool TryGetIdentity(EndpointAddress reference, out EndpointIdentity identity) { return this.defaultVerifier.TryGetIdentity(reference, out identity); diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_generatedcodefiles/cs/duplexproxycode.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_generatedcodefiles/cs/duplexproxycode.cs index 7341f0a10edfd..ac939d5ae04a9 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_generatedcodefiles/cs/duplexproxycode.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_generatedcodefiles/cs/duplexproxycode.cs @@ -13,16 +13,16 @@ [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")] // [System.ServiceModel.ServiceContractAttribute( - Namespace="http://microsoft.wcf.documentation", - ConfigurationName="SampleDuplexHello", - CallbackContract=typeof(SampleDuplexHelloCallback), + Namespace="http://microsoft.wcf.documentation", + ConfigurationName="SampleDuplexHello", + CallbackContract=typeof(SampleDuplexHelloCallback), SessionMode=System.ServiceModel.SessionMode.Required )] public interface SampleDuplexHello { // [System.ServiceModel.OperationContractAttribute( - IsOneWay=true, + IsOneWay=true, Action="http://microsoft.wcf.documentation/SampleDuplexHello/Hello" )] void Hello(string greeting); @@ -36,7 +36,7 @@ public interface SampleDuplexHelloCallback { // [System.ServiceModel.OperationContractAttribute( - IsOneWay=true, + IsOneWay=true, Action="http://microsoft.wcf.documentation/SampleDuplexHello/Reply" )] void Reply(string responseToGreeting); @@ -56,32 +56,32 @@ public interface SampleDuplexHelloChannel : SampleDuplexHello, System.ServiceMod // public partial class SampleDuplexHelloClient : System.ServiceModel.DuplexClientBase, SampleDuplexHello { - - public SampleDuplexHelloClient(System.ServiceModel.InstanceContext callbackInstance) : + + public SampleDuplexHelloClient(System.ServiceModel.InstanceContext callbackInstance) : base(callbackInstance) { } - - public SampleDuplexHelloClient(System.ServiceModel.InstanceContext callbackInstance, string endpointConfigurationName) : + + public SampleDuplexHelloClient(System.ServiceModel.InstanceContext callbackInstance, string endpointConfigurationName) : base(callbackInstance, endpointConfigurationName) { } - - public SampleDuplexHelloClient(System.ServiceModel.InstanceContext callbackInstance, string endpointConfigurationName, string remoteAddress) : + + public SampleDuplexHelloClient(System.ServiceModel.InstanceContext callbackInstance, string endpointConfigurationName, string remoteAddress) : base(callbackInstance, endpointConfigurationName, remoteAddress) { } - - public SampleDuplexHelloClient(System.ServiceModel.InstanceContext callbackInstance, string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : + + public SampleDuplexHelloClient(System.ServiceModel.InstanceContext callbackInstance, string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : base(callbackInstance, endpointConfigurationName, remoteAddress) { } - - public SampleDuplexHelloClient(System.ServiceModel.InstanceContext callbackInstance, System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : + + public SampleDuplexHelloClient(System.ServiceModel.InstanceContext callbackInstance, System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : base(callbackInstance, binding, remoteAddress) { } - + public void Hello(string greeting) { base.Channel.Hello(greeting); diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_generatedcodefiles/cs/proxycode.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_generatedcodefiles/cs/proxycode.cs index 1eefb63506b6e..5989173ebfd3a 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_generatedcodefiles/cs/proxycode.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_generatedcodefiles/cs/proxycode.cs @@ -76,7 +76,7 @@ public interface ISampleService // /* -// +// [ServiceContractAttribute( Namespace = "http://microsoft.wcf.documentation" )] diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_how_to_cf_async/cs/generatedclient.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_how_to_cf_async/cs/generatedclient.cs index 850914aa4c82e..0cd0757f30baf 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_how_to_cf_async/cs/generatedclient.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_how_to_cf_async/cs/generatedclient.cs @@ -11,137 +11,137 @@ namespace Microsoft.ServiceModel.Samples { - - + + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")] [System.ServiceModel.ServiceContractAttribute(Namespace="http://Microsoft.ServiceModel.Samples", ConfigurationName="Microsoft.ServiceModel.Samples.ICalculator")] // public interface ICalculator { - + [System.ServiceModel.OperationContractAttribute(Action="http://Microsoft.ServiceModel.Samples/ICalculator/Add", ReplyAction="http://Microsoft.ServiceModel.Samples/ICalculator/AddResponse")] double Add(double n1, double n2); - + [System.ServiceModel.OperationContractAttribute(AsyncPattern=true, Action="http://Microsoft.ServiceModel.Samples/ICalculator/Add", ReplyAction="http://Microsoft.ServiceModel.Samples/ICalculator/AddResponse")] System.IAsyncResult BeginAdd(double n1, double n2, System.AsyncCallback callback, object asyncState); - + double EndAdd(System.IAsyncResult result); // - + [System.ServiceModel.OperationContractAttribute(Action="http://Microsoft.ServiceModel.Samples/ICalculator/Subtract", ReplyAction="http://Microsoft.ServiceModel.Samples/ICalculator/SubtractResponse")] double Subtract(double n1, double n2); - + [System.ServiceModel.OperationContractAttribute(AsyncPattern=true, Action="http://Microsoft.ServiceModel.Samples/ICalculator/Subtract", ReplyAction="http://Microsoft.ServiceModel.Samples/ICalculator/SubtractResponse")] System.IAsyncResult BeginSubtract(double n1, double n2, System.AsyncCallback callback, object asyncState); - + double EndSubtract(System.IAsyncResult result); - + [System.ServiceModel.OperationContractAttribute(Action="http://Microsoft.ServiceModel.Samples/ICalculator/Multiply", ReplyAction="http://Microsoft.ServiceModel.Samples/ICalculator/MultiplyResponse")] double Multiply(double n1, double n2); - + [System.ServiceModel.OperationContractAttribute(AsyncPattern=true, Action="http://Microsoft.ServiceModel.Samples/ICalculator/Multiply", ReplyAction="http://Microsoft.ServiceModel.Samples/ICalculator/MultiplyResponse")] System.IAsyncResult BeginMultiply(double n1, double n2, System.AsyncCallback callback, object asyncState); - + double EndMultiply(System.IAsyncResult result); - + [System.ServiceModel.OperationContractAttribute(Action="http://Microsoft.ServiceModel.Samples/ICalculator/Divide", ReplyAction="http://Microsoft.ServiceModel.Samples/ICalculator/DivideResponse")] double Divide(double n1, double n2); - + [System.ServiceModel.OperationContractAttribute(AsyncPattern=true, Action="http://Microsoft.ServiceModel.Samples/ICalculator/Divide", ReplyAction="http://Microsoft.ServiceModel.Samples/ICalculator/DivideResponse")] System.IAsyncResult BeginDivide(double n1, double n2, System.AsyncCallback callback, object asyncState); - + double EndDivide(System.IAsyncResult result); } - + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")] public interface ICalculatorChannel : Microsoft.ServiceModel.Samples.ICalculator, System.ServiceModel.IClientChannel { } - + [System.Diagnostics.DebuggerStepThroughAttribute()] [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")] public partial class CalculatorClient : System.ServiceModel.ClientBase, Microsoft.ServiceModel.Samples.ICalculator { - + public CalculatorClient() { } - - public CalculatorClient(string endpointConfigurationName) : + + public CalculatorClient(string endpointConfigurationName) : base(endpointConfigurationName) { } - - public CalculatorClient(string endpointConfigurationName, string remoteAddress) : + + public CalculatorClient(string endpointConfigurationName, string remoteAddress) : base(endpointConfigurationName, remoteAddress) { } - - public CalculatorClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : + + public CalculatorClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : base(endpointConfigurationName, remoteAddress) { } - - public CalculatorClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : + + public CalculatorClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : base(binding, remoteAddress) { } - + public double Add(double n1, double n2) { return base.Channel.Add(n1, n2); } - + public System.IAsyncResult BeginAdd(double n1, double n2, System.AsyncCallback callback, object asyncState) { return base.Channel.BeginAdd(n1, n2, callback, asyncState); } - + public double EndAdd(System.IAsyncResult result) { return base.Channel.EndAdd(result); } - + public double Subtract(double n1, double n2) { return base.Channel.Subtract(n1, n2); } - + public System.IAsyncResult BeginSubtract(double n1, double n2, System.AsyncCallback callback, object asyncState) { return base.Channel.BeginSubtract(n1, n2, callback, asyncState); } - + public double EndSubtract(System.IAsyncResult result) { return base.Channel.EndSubtract(result); } - + public double Multiply(double n1, double n2) { return base.Channel.Multiply(n1, n2); } - + public System.IAsyncResult BeginMultiply(double n1, double n2, System.AsyncCallback callback, object asyncState) { return base.Channel.BeginMultiply(n1, n2, callback, asyncState); } - + public double EndMultiply(System.IAsyncResult result) { return base.Channel.EndMultiply(result); } - + public double Divide(double n1, double n2) { return base.Channel.Divide(n1, n2); } - + public System.IAsyncResult BeginDivide(double n1, double n2, System.AsyncCallback callback, object asyncState) { return base.Channel.BeginDivide(n1, n2, callback, asyncState); } - + public double EndDivide(System.IAsyncResult result) { return base.Channel.EndDivide(result); diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_howto_changestandardbinding/cs/program.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_howto_changestandardbinding/cs/program.cs index 54193e9782c7e..c39215016ea26 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_howto_changestandardbinding/cs/program.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_howto_changestandardbinding/cs/program.cs @@ -10,7 +10,7 @@ class ChangeStandardBinding static void Main(string[] args) { // - // Create an instance of the T:System.ServiceModel.BasicHttpBinding + // Create an instance of the T:System.ServiceModel.BasicHttpBinding // class and set its security mode to message-level security. BasicHttpBinding binding = new BasicHttpBinding(); binding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.Certificate; @@ -18,9 +18,9 @@ static void Main(string[] args) // // - // Create a custom binding from the binding + // Create a custom binding from the binding CustomBinding cb = new CustomBinding(binding); - // Get the BindingElementCollection from this custom binding + // Get the BindingElementCollection from this custom binding BindingElementCollection bec = cb.Elements(); // diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_howto_codeclientbinding/cs/client.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_howto_codeclientbinding/cs/client.cs index 4dca06f4c90bd..3dd2fe00468d8 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_howto_codeclientbinding/cs/client.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_howto_codeclientbinding/cs/client.cs @@ -40,7 +40,7 @@ public double Divide(double n1, double n2) { return n1 / n2; } - } + } [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")] public interface ICalculatorChannel : Microsoft.ServiceModel.Samples.ICalculator, System.ServiceModel.IClientChannel @@ -51,46 +51,46 @@ public interface ICalculatorChannel : Microsoft.ServiceModel.Samples.ICalculator public class CalculatorClient : System.ServiceModel.ClientBase, Microsoft.ServiceModel.Samples.ICalculator { - + public CalculatorClient() { } - - public CalculatorClient(string endpointConfigurationName) : + + public CalculatorClient(string endpointConfigurationName) : base(endpointConfigurationName) { } - - public CalculatorClient(string endpointConfigurationName, string remoteAddress) : + + public CalculatorClient(string endpointConfigurationName, string remoteAddress) : base(endpointConfigurationName, remoteAddress) { } - - public CalculatorClient(string endpointConfigurationName, EndpointAddress remoteAddress) : + + public CalculatorClient(string endpointConfigurationName, EndpointAddress remoteAddress) : base(endpointConfigurationName, remoteAddress) { } - - public CalculatorClient(Binding binding, EndpointAddress remoteAddress) : + + public CalculatorClient(Binding binding, EndpointAddress remoteAddress) : base(binding, remoteAddress) { } - + public double Add(double n1, double n2) { return base.Channel.Add(n1, n2); } - + public double Subtract(double n1, double n2) { return base.Channel.Subtract(n1, n2); } - + public double Multiply(double n1, double n2) { return base.Channel.Multiply(n1, n2); } - + public double Divide(double n1, double n2) { return base.Channel.Divide(n1, n2); @@ -111,7 +111,7 @@ static void Main() BasicHttpBinding binding = new BasicHttpBinding(); //Specify the address to be used for the client. - EndpointAddress address = + EndpointAddress address = new EndpointAddress("http://localhost/servicemodelsamples/service.svc"); // Create a client that is configured with this address and binding. @@ -150,5 +150,5 @@ static void Main() } } } - + // diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_howto_codeclientbinding/cs/generatedclient.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_howto_codeclientbinding/cs/generatedclient.cs index 0f912ac273ee1..16633f9261a40 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_howto_codeclientbinding/cs/generatedclient.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_howto_codeclientbinding/cs/generatedclient.cs @@ -2,27 +2,27 @@ namespace Microsoft.ServiceModel.Samples { - - // + + // [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")] [System.ServiceModel.ServiceContractAttribute(Namespace="http://Microsoft.ServiceModel.Samples", ConfigurationName="Microsoft.ServiceModel.Samples.ICalculator")] public interface ICalculator { - + [System.ServiceModel.OperationContractAttribute(Action="http://Microsoft.ServiceModel.Samples/ICalculator/Add", ReplyAction="http://Microsoft.ServiceModel.Samples/ICalculator/AddResponse")] double Add(double n1, double n2); - + [System.ServiceModel.OperationContractAttribute(Action="http://Microsoft.ServiceModel.Samples/ICalculator/Subtract", ReplyAction="http://Microsoft.ServiceModel.Samples/ICalculator/SubtractResponse")] double Subtract(double n1, double n2); - + [System.ServiceModel.OperationContractAttribute(Action="http://Microsoft.ServiceModel.Samples/ICalculator/Multiply", ReplyAction="http://Microsoft.ServiceModel.Samples/ICalculator/MultiplyResponse")] double Multiply(double n1, double n2); - + [System.ServiceModel.OperationContractAttribute(Action="http://Microsoft.ServiceModel.Samples/ICalculator/Divide", ReplyAction="http://Microsoft.ServiceModel.Samples/ICalculator/DivideResponse")] double Divide(double n1, double n2); } // - + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")] public interface ICalculatorChannel : Microsoft.ServiceModel.Samples.ICalculator, System.ServiceModel.IClientChannel { @@ -33,46 +33,46 @@ public interface ICalculatorChannel : Microsoft.ServiceModel.Samples.ICalculator [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")] public partial class CalculatorClient : System.ServiceModel.ClientBase, Microsoft.ServiceModel.Samples.ICalculator { - + public CalculatorClient() { } - - public CalculatorClient(string endpointConfigurationName) : + + public CalculatorClient(string endpointConfigurationName) : base(endpointConfigurationName) { } - - public CalculatorClient(string endpointConfigurationName, string remoteAddress) : + + public CalculatorClient(string endpointConfigurationName, string remoteAddress) : base(endpointConfigurationName, remoteAddress) { } - - public CalculatorClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : + + public CalculatorClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : base(endpointConfigurationName, remoteAddress) { } - - public CalculatorClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : + + public CalculatorClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : base(binding, remoteAddress) { } - + public double Add(double n1, double n2) { return base.Channel.Add(n1, n2); } - + public double Subtract(double n1, double n2) { return base.Channel.Subtract(n1, n2); } - + public double Multiply(double n1, double n2) { return base.Channel.Multiply(n1, n2); } - + public double Divide(double n1, double n2) { return base.Channel.Divide(n1, n2); diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_howto_codeservicebinding/cs/source.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_howto_codeservicebinding/cs/source.cs index 31673c14964fd..78c0767f0e962 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_howto_codeservicebinding/cs/source.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_howto_codeservicebinding/cs/source.cs @@ -39,7 +39,7 @@ public double Divide(double n1, double n2) { return n1 / n2; } - } + } // @@ -57,7 +57,7 @@ public static void Main() BasicHttpBinding binding1 = new BasicHttpBinding(); // // - + TimeSpan modifiedCloseTimeout = new TimeSpan(00, 02, 00); binding1.CloseTimeout = modifiedCloseTimeout; // @@ -65,7 +65,7 @@ public static void Main() // // - + using(ServiceHost host = new ServiceHost(typeof(CalculatorService))) { host.AddServiceEndpoint(typeof(ICalculator),binding1, baseAddress); diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_howto_configureclientbinding/cs/client.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_howto_configureclientbinding/cs/client.cs index 82b9baf68f185..2d8336bddab9a 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_howto_configureclientbinding/cs/client.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_howto_configureclientbinding/cs/client.cs @@ -47,5 +47,5 @@ static void Main() } } } - + // diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_howto_configureclientbinding/cs/generatedclient.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_howto_configureclientbinding/cs/generatedclient.cs index ded75b1ab0f5e..879b431762388 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_howto_configureclientbinding/cs/generatedclient.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_howto_configureclientbinding/cs/generatedclient.cs @@ -2,27 +2,27 @@ namespace Microsoft.ServiceModel.Samples { - - // + + // [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")] [System.ServiceModel.ServiceContractAttribute(Namespace="http://Microsoft.ServiceModel.Samples", ConfigurationName="Microsoft.ServiceModel.Samples.ICalculator")] public interface ICalculator { - + [System.ServiceModel.OperationContractAttribute(Action="http://Microsoft.ServiceModel.Samples/ICalculator/Add", ReplyAction="http://Microsoft.ServiceModel.Samples/ICalculator/AddResponse")] double Add(double n1, double n2); - + [System.ServiceModel.OperationContractAttribute(Action="http://Microsoft.ServiceModel.Samples/ICalculator/Subtract", ReplyAction="http://Microsoft.ServiceModel.Samples/ICalculator/SubtractResponse")] double Subtract(double n1, double n2); - + [System.ServiceModel.OperationContractAttribute(Action="http://Microsoft.ServiceModel.Samples/ICalculator/Multiply", ReplyAction="http://Microsoft.ServiceModel.Samples/ICalculator/MultiplyResponse")] double Multiply(double n1, double n2); - + [System.ServiceModel.OperationContractAttribute(Action="http://Microsoft.ServiceModel.Samples/ICalculator/Divide", ReplyAction="http://Microsoft.ServiceModel.Samples/ICalculator/DivideResponse")] double Divide(double n1, double n2); } // - + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")] public interface ICalculatorChannel : Microsoft.ServiceModel.Samples.ICalculator, System.ServiceModel.IClientChannel { @@ -33,46 +33,46 @@ public interface ICalculatorChannel : Microsoft.ServiceModel.Samples.ICalculator [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")] public partial class CalculatorClient : System.ServiceModel.ClientBase, Microsoft.ServiceModel.Samples.ICalculator { - + public CalculatorClient() { } - - public CalculatorClient(string endpointConfigurationName) : + + public CalculatorClient(string endpointConfigurationName) : base(endpointConfigurationName) { } - - public CalculatorClient(string endpointConfigurationName, string remoteAddress) : + + public CalculatorClient(string endpointConfigurationName, string remoteAddress) : base(endpointConfigurationName, remoteAddress) { } - - public CalculatorClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : + + public CalculatorClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : base(endpointConfigurationName, remoteAddress) { } - - public CalculatorClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : + + public CalculatorClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : base(binding, remoteAddress) { } - + public double Add(double n1, double n2) { return base.Channel.Add(n1, n2); } - + public double Subtract(double n1, double n2) { return base.Channel.Subtract(n1, n2); } - + public double Multiply(double n1, double n2) { return base.Channel.Multiply(n1, n2); } - + public double Divide(double n1, double n2) { return base.Channel.Divide(n1, n2); diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_howto_configureclientbinding/cs/source.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_howto_configureclientbinding/cs/source.cs index 1c0bdb1f0a3d8..999360c42af1e 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_howto_configureclientbinding/cs/source.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_howto_configureclientbinding/cs/source.cs @@ -39,7 +39,7 @@ public double Divide(double n1, double n2) { return n1 / n2; } - } + } // diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_howto_configureservicebinding/cs/source.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_howto_configureservicebinding/cs/source.cs index 1c0bdb1f0a3d8..999360c42af1e 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_howto_configureservicebinding/cs/source.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_howto_configureservicebinding/cs/source.cs @@ -39,7 +39,7 @@ public double Divide(double n1, double n2) { return n1 / n2; } - } + } // diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_howto_createcontractwithclass/cs/source.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_howto_createcontractwithclass/cs/source.cs index 58c796e83999e..ddbbf4b65c77f 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_howto_createcontractwithclass/cs/source.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_howto_createcontractwithclass/cs/source.cs @@ -31,7 +31,7 @@ public double Divide(double n1, double n2) { return n1 / n2; } - } + } // diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_howto_createcontractwithinterface/cs/source.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_howto_createcontractwithinterface/cs/source.cs index fcf277316c228..8745149cab47f 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_howto_createcontractwithinterface/cs/source.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_howto_createcontractwithinterface/cs/source.cs @@ -5,11 +5,11 @@ namespace Samples { // -using System.ServiceModel; +using System.ServiceModel; -[ServiceContract] -public interface ICalculator -{ +[ServiceContract] +public interface ICalculator +{ [OperationContract] double Add(double n1, double n2); [OperationContract] diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_howto_createreliablesessionhttps/cs/client.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_howto_createreliablesessionhttps/cs/client.cs index 25db388c9b9ed..0c22091ee12a1 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_howto_createreliablesessionhttps/cs/client.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_howto_createreliablesessionhttps/cs/client.cs @@ -8,27 +8,27 @@ namespace Microsoft.ServiceModel.Samples // // Generated interface defining the ICalculator contract [System.ServiceModel.ServiceContractAttribute( - Namespace="http://Microsoft.ServiceModel.Samples", + Namespace="http://Microsoft.ServiceModel.Samples", ConfigurationName="Microsoft.ServiceModel.Samples.ICalculator")] public interface ICalculator { [System.ServiceModel.OperationContractAttribute( - Action="http://Microsoft.ServiceModel.Samples/ICalculator/Add", + Action="http://Microsoft.ServiceModel.Samples/ICalculator/Add", ReplyAction="http://Microsoft.ServiceModel.Samples/ICalculator/AddResponse")] double Add(double n1, double n2); - + [System.ServiceModel.OperationContractAttribute( - Action="http://Microsoft.ServiceModel.Samples/ICalculator/Subtract", + Action="http://Microsoft.ServiceModel.Samples/ICalculator/Subtract", ReplyAction="http://Microsoft.ServiceModel.Samples/ICalculator/SubtractResponse")] double Subtract(double n1, double n2); - + [System.ServiceModel.OperationContractAttribute( - Action="http://Microsoft.ServiceModel.Samples/ICalculator/Multiply", + Action="http://Microsoft.ServiceModel.Samples/ICalculator/Multiply", ReplyAction="http://Microsoft.ServiceModel.Samples/ICalculator/MultiplyResponse")] double Multiply(double n1, double n2); - + [System.ServiceModel.OperationContractAttribute( - Action="http://Microsoft.ServiceModel.Samples/ICalculator/Divide", + Action="http://Microsoft.ServiceModel.Samples/ICalculator/Divide", ReplyAction="http://Microsoft.ServiceModel.Samples/ICalculator/DivideResponse")] double Divide(double n1, double n2); } @@ -36,51 +36,51 @@ public interface ICalculator // // Implementation of the CalculatorClient - public partial class CalculatorClient : - System.ServiceModel.ClientBase, + public partial class CalculatorClient : + System.ServiceModel.ClientBase, Microsoft.ServiceModel.Samples.ICalculator { public CalculatorClient() { } - - public CalculatorClient(string endpointConfigurationName) : + + public CalculatorClient(string endpointConfigurationName) : base(endpointConfigurationName) { } - - public CalculatorClient(string endpointConfigurationName, string remoteAddress) : + + public CalculatorClient(string endpointConfigurationName, string remoteAddress) : base(endpointConfigurationName, remoteAddress) { } - - public CalculatorClient(string endpointConfigurationName, - System.ServiceModel.EndpointAddress remoteAddress) : + + public CalculatorClient(string endpointConfigurationName, + System.ServiceModel.EndpointAddress remoteAddress) : base(endpointConfigurationName, remoteAddress) { } - - public CalculatorClient(System.ServiceModel.Channels.Binding binding, - System.ServiceModel.EndpointAddress remoteAddress) : + + public CalculatorClient(System.ServiceModel.Channels.Binding binding, + System.ServiceModel.EndpointAddress remoteAddress) : base(binding, remoteAddress) { } - + public double Add(double n1, double n2) { return base.Channel.Add(n1, n2); } - + public double Subtract(double n1, double n2) { return base.Channel.Subtract(n1, n2); } - + public double Multiply(double n1, double n2) { return base.Channel.Multiply(n1, n2); } - + public double Divide(double n1, double n2) { return base.Channel.Divide(n1, n2); diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_howto_createreliablesessionhttps/cs/service.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_howto_createreliablesessionhttps/cs/service.cs index 23747d48f5804..ead83e32a123c 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_howto_createreliablesessionhttps/cs/service.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_howto_createreliablesessionhttps/cs/service.cs @@ -39,7 +39,7 @@ public double Divide(double n1, double n2) { return n1 / n2; } - } + } // public class Test diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_howto_enablestreaming/cs/service.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_howto_enablestreaming/cs/service.cs index 35fefd23a06f1..c606a0eb96c8c 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_howto_enablestreaming/cs/service.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_howto_enablestreaming/cs/service.cs @@ -33,13 +33,13 @@ public Stream GetStream(string data) { //this file path assumes the image is in // the Service folder and the service is executing - // in service/bin + // in service/bin string filePath = Path.Combine( System.Environment.CurrentDirectory, ".\\..\\image.jpg"); - //open the file, this could throw an exception + //open the file, this could throw an exception //(e.g. if the file is not found) - //having includeExceptionDetailInFaults="True" in config + //having includeExceptionDetailInFaults="True" in config // would cause this exception to be returned to the client try { diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_howto_hostiniis/cs/source.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_howto_hostiniis/cs/source.cs index a7efa853d8c7f..bc300ee6d763c 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_howto_hostiniis/cs/source.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_howto_hostiniis/cs/source.cs @@ -42,7 +42,7 @@ public double Divide(double n1, double n2) { return n1 / n2; } - } + } // // diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_howto_hostinntservice/cs/service.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_howto_hostinntservice/cs/service.cs index 43ea60a133b79..a9c57dbc54228 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_howto_hostinntservice/cs/service.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_howto_hostinntservice/cs/service.cs @@ -86,11 +86,11 @@ protected override void OnStart(string[] args) serviceHost.Close(); } - // Create a ServiceHost for the CalculatorService type and + // Create a ServiceHost for the CalculatorService type and // provide the base address. serviceHost = new ServiceHost(typeof(CalculatorService)); - // Open the ServiceHostBase to create listeners and start + // Open the ServiceHostBase to create listeners and start // listening for messages. serviceHost.Open(); } @@ -109,7 +109,7 @@ protected override void OnStop() } // - // Provide the ProjectInstaller class which allows + // Provide the ProjectInstaller class which allows // the service to be installed by the Installutil.exe tool [RunInstaller(true)] public class ProjectInstaller : Installer @@ -127,6 +127,6 @@ public ProjectInstaller() Installers.Add(service); } } - // + // } // \ No newline at end of file diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_howto_hostinwas/cs/client.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_howto_hostinwas/cs/client.cs index 0316ce3c02dc3..af8308cd2ee8b 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_howto_hostinwas/cs/client.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_howto_hostinwas/cs/client.cs @@ -13,19 +13,19 @@ namespace Microsoft.ServiceModel.Samples Namespace="http://Microsoft.ServiceModel.Samples", ConfigurationName="Microsoft.ServiceModel.Samples.ICalculator")] public interface ICalculator { - + [System.ServiceModel.OperationContractAttribute( Action="http://Microsoft.ServiceModel.Samples/ICalculator/Add", ReplyAction="http://Microsoft.ServiceModel.Samples/ICalculator/AddResponse")] double Add(double n1, double n2); - + [System.ServiceModel.OperationContractAttribute( Action="http://Microsoft.ServiceModel.Samples/ICalculator/Subtract", ReplyAction="http://Microsoft.ServiceModel.Samples/ICalculator/SubtractResponse")] double Subtract(double n1, double n2); - + [System.ServiceModel.OperationContractAttribute( Action="http://Microsoft.ServiceModel.Samples/ICalculator/Multiply", ReplyAction="http://Microsoft.ServiceModel.Samples/ICalculator/MultiplyResponse")] double Multiply(double n1, double n2); - + [System.ServiceModel.OperationContractAttribute( Action="http://Microsoft.ServiceModel.Samples/ICalculator/Divide", ReplyAction="http://Microsoft.ServiceModel.Samples/ICalculator/DivideResponse")] double Divide(double n1, double n2); @@ -36,47 +36,47 @@ public interface ICalculator // Implementation of the CalculatorClient public partial class CalculatorClient : System.ServiceModel.ClientBase, Microsoft.ServiceModel.Samples.ICalculator { - + public CalculatorClient() { } - - public CalculatorClient(string endpointConfigurationName) : + + public CalculatorClient(string endpointConfigurationName) : base(endpointConfigurationName) { } - - public CalculatorClient(string endpointConfigurationName, string remoteAddress) : + + public CalculatorClient(string endpointConfigurationName, string remoteAddress) : base(endpointConfigurationName, remoteAddress) { } - - public CalculatorClient(string endpointConfigurationName, - System.ServiceModel.EndpointAddress remoteAddress) : + + public CalculatorClient(string endpointConfigurationName, + System.ServiceModel.EndpointAddress remoteAddress) : base(endpointConfigurationName, remoteAddress) { } - - public CalculatorClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : + + public CalculatorClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : base(binding, remoteAddress) { } - + public double Add(double n1, double n2) { return base.Channel.Add(n1, n2); } - + public double Subtract(double n1, double n2) { return base.Channel.Subtract(n1, n2); } - + public double Multiply(double n1, double n2) { return base.Channel.Multiply(n1, n2); } - + public double Divide(double n1, double n2) { return base.Channel.Divide(n1, n2); diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_howto_hostinwas/cs/service.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_howto_hostinwas/cs/service.cs index f9e21402516a1..5ee84b3c55a63 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_howto_hostinwas/cs/service.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_howto_hostinwas/cs/service.cs @@ -42,7 +42,7 @@ public double Divide(double n1, double n2) { return n1 / n2; } - } + } // diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_howto_usereliablesession/cs/client.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_howto_usereliablesession/cs/client.cs index b848f1fea59c1..2df9e52fefc51 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_howto_usereliablesession/cs/client.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_howto_usereliablesession/cs/client.cs @@ -8,27 +8,27 @@ namespace Microsoft.ServiceModel.Samples // //Generated interface defining the ICalculator contract [System.ServiceModel.ServiceContractAttribute( - Namespace="http://Microsoft.ServiceModel.Samples", + Namespace="http://Microsoft.ServiceModel.Samples", ConfigurationName="Microsoft.ServiceModel.Samples.ICalculator")] public interface ICalculator { [System.ServiceModel.OperationContractAttribute( - Action="http://Microsoft.ServiceModel.Samples/ICalculator/Add", + Action="http://Microsoft.ServiceModel.Samples/ICalculator/Add", ReplyAction="http://Microsoft.ServiceModel.Samples/ICalculator/AddResponse")] double Add(double n1, double n2); - + [System.ServiceModel.OperationContractAttribute( - Action="http://Microsoft.ServiceModel.Samples/ICalculator/Subtract", + Action="http://Microsoft.ServiceModel.Samples/ICalculator/Subtract", ReplyAction="http://Microsoft.ServiceModel.Samples/ICalculator/SubtractResponse")] double Subtract(double n1, double n2); - + [System.ServiceModel.OperationContractAttribute( - Action="http://Microsoft.ServiceModel.Samples/ICalculator/Multiply", + Action="http://Microsoft.ServiceModel.Samples/ICalculator/Multiply", ReplyAction="http://Microsoft.ServiceModel.Samples/ICalculator/MultiplyResponse")] double Multiply(double n1, double n2); - + [System.ServiceModel.OperationContractAttribute( - Action="http://Microsoft.ServiceModel.Samples/ICalculator/Divide", + Action="http://Microsoft.ServiceModel.Samples/ICalculator/Divide", ReplyAction="http://Microsoft.ServiceModel.Samples/ICalculator/DivideResponse")] double Divide(double n1, double n2); } @@ -36,51 +36,51 @@ public interface ICalculator // // Implementation of the CalculatorClient - public partial class CalculatorClient : - System.ServiceModel.ClientBase, + public partial class CalculatorClient : + System.ServiceModel.ClientBase, Microsoft.ServiceModel.Samples.ICalculator { public CalculatorClient() { } - - public CalculatorClient(string endpointConfigurationName) : + + public CalculatorClient(string endpointConfigurationName) : base(endpointConfigurationName) { } - - public CalculatorClient(string endpointConfigurationName, string remoteAddress) : + + public CalculatorClient(string endpointConfigurationName, string remoteAddress) : base(endpointConfigurationName, remoteAddress) { } - - public CalculatorClient(string endpointConfigurationName, - System.ServiceModel.EndpointAddress remoteAddress) : + + public CalculatorClient(string endpointConfigurationName, + System.ServiceModel.EndpointAddress remoteAddress) : base(endpointConfigurationName, remoteAddress) { } - - public CalculatorClient(System.ServiceModel.Channels.Binding binding, - System.ServiceModel.EndpointAddress remoteAddress) : + + public CalculatorClient(System.ServiceModel.Channels.Binding binding, + System.ServiceModel.EndpointAddress remoteAddress) : base(binding, remoteAddress) { } - + public double Add(double n1, double n2) { return base.Channel.Add(n1, n2); } - + public double Subtract(double n1, double n2) { return base.Channel.Subtract(n1, n2); } - + public double Multiply(double n1, double n2) { return base.Channel.Multiply(n1, n2); } - + public double Divide(double n1, double n2) { return base.Channel.Divide(n1, n2); diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_howto_usereliablesession/cs/service.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_howto_usereliablesession/cs/service.cs index 7c5ffe3b267b3..17a4a55d1c594 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_howto_usereliablesession/cs/service.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_howto_usereliablesession/cs/service.cs @@ -39,7 +39,7 @@ public double Divide(double n1, double n2) { return n1 / n2; } - } + } // public class Test diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_howtosecureendpoint/cs/source.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_howtosecureendpoint/cs/source.cs index f1364fa86e667..bec4b99e4c7fe 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_howtosecureendpoint/cs/source.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_howtosecureendpoint/cs/source.cs @@ -25,26 +25,26 @@ private void Run() myBinding.Security.Message.ClientCredentialType = MessageCredentialType.Windows; - // Create the Type instances for later use and the URI for + // Create the Type instances for later use and the URI for // the base address. Type contractType = typeof(ICalculator); Type serviceType = typeof(Calculator); Uri baseAddress = new Uri("http://localhost:8037/serviceModelSamples/"); - - // Create the ServiceHost and add an endpoint. + + // Create the ServiceHost and add an endpoint. ServiceHost myServiceHost = new ServiceHost(serviceType, baseAddress); myServiceHost.AddServiceEndpoint (contractType, myBinding, "secureCalculator"); // - // Create a new metadata behavior object and set its properties to - // create a secure endpoint. + // Create a new metadata behavior object and set its properties to + // create a secure endpoint. ServiceMetadataBehavior sb = new ServiceMetadataBehavior(); sb.HttpsGetEnabled = true; sb.HttpsGetUrl = new Uri("https://myMachineName:8036/myEndpoint"); myServiceHost.Description.Behaviors.Add(sb); - + myServiceHost.Open(); // // Use the GetHostEntry method to return the actual machine name. diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_howtosetcustomclientidentity/cs/source.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_howtosetcustomclientidentity/cs/source.cs index 7752529bfa9c0..94872325d0519 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_howtosetcustomclientidentity/cs/source.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_howtosetcustomclientidentity/cs/source.cs @@ -76,10 +76,10 @@ class Client public static void CallServiceCustomClientIdentity(string endpointName) { - // Create a custom binding that sets a custom IdentityVerifier. + // Create a custom binding that sets a custom IdentityVerifier. Binding customSecurityBinding = CreateCustomSecurityBinding(); // Call the service with DNS identity, setting a custom EndpointIdentity that checks that the certificate - // returned from the service contains an organization name of Contoso in the subject name; that is, O=Contoso. + // returned from the service contains an organization name of Contoso in the subject name; that is, O=Contoso. EndpointAddress serviceAddress = new EndpointAddress(new Uri("http://localhost:8003/servicemodelsamples/service/dnsidentity"), new OrgEndpointIdentity("O=Contoso")); // @@ -90,12 +90,12 @@ public static void CallServiceCustomClientIdentity(string endpointName) StoreName.TrustedPeople, X509FindType.FindBySubjectDistinguishedName, "CN=identity.com, O=Contoso"); - // Setting the certificateValidationMode to PeerOrChainTrust means that if the certificate + // Setting the certificateValidationMode to PeerOrChainTrust means that if the certificate // is in the user's Trusted People store, then it will be trusted without performing a - // validation of the certificate's issuer chain. This setting is used here for convenience so that the + // validation of the certificate's issuer chain. This setting is used here for convenience so that the // sample can be run without having to have certificates issued by a certificate authority (CA). - // This setting is less secure than the default, ChainTrust. The security implications of this - // setting should be carefully considered before using PeerOrChainTrust in production code. + // This setting is less secure than the default, ChainTrust. The security implications of this + // setting should be carefully considered before using PeerOrChainTrust in production code. client.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.PeerOrChainTrust; Console.WriteLine("Calling Endpoint: {0}", endpointName); @@ -121,7 +121,7 @@ public static Binding CreateCustomSecurityBinding() WSHttpBinding binding = new WSHttpBinding(SecurityMode.Message); //Clients are anonymous to the service. binding.Security.Message.ClientCredentialType = MessageCredentialType.None; - //Secure conversation is turned off for simplification. If secure conversation is turned on, then + //Secure conversation is turned off for simplification. If secure conversation is turned on, then //you also need to set the IdentityVerifier on the secureconversation bootstrap binding. binding.Security.Message.EstablishSecurityContext = false; @@ -156,7 +156,7 @@ public string OrganizationClaim // // This custom IdentityVerifier uses the supplied OrgEndpointIdentity to check that that - // X.509 certificate's distinguished name claim contains the organization name; for example, O=Contoso. + // X.509 certificate's distinguished name claim contains the organization name; for example, O=Contoso. // class CustomIdentityVerifier : IdentityVerifier { diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_howtousechannelfactory/cs/source.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_howtousechannelfactory/cs/source.cs index 189c8eeac25aa..0719dad10e9b9 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_howtousechannelfactory/cs/source.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_howtousechannelfactory/cs/source.cs @@ -12,7 +12,7 @@ interface IMath public class Math : IMath { - public double Add(double A, double B) + public double Add(double A, double B) { return A + B; } diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_idatacontractsurrogate/cs/source.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_idatacontractsurrogate/cs/source.cs index db5b39e9ea76a..1e92c360e8d08 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_idatacontractsurrogate/cs/source.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_idatacontractsurrogate/cs/source.cs @@ -250,7 +250,7 @@ private void Run() foreach (ServiceEndpoint ep in serviceHost.Description.Endpoints) { foreach (OperationDescription op in ep.Contract.Operations) - { + { DataContractSerializerOperationBehavior dataContractBehavior = op.Behaviors.Find() as DataContractSerializerOperationBehavior; @@ -296,7 +296,7 @@ private void MetadataImport() // WsdlExporter exporter = new WsdlExporter(); //or - //public void ExportContract(WsdlExporter exporter, + //public void ExportContract(WsdlExporter exporter, // WsdlContractConversionContext context) { ... } object dataContractExporter; XsdDataContractExporter xsdInventoryExporter; diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_impersonationanddelegation/cs/source.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_impersonationanddelegation/cs/source.cs index f8f3e7006def1..0f4dfccdc92d6 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_impersonationanddelegation/cs/source.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_impersonationanddelegation/cs/source.cs @@ -80,18 +80,18 @@ private void ServiceAuthorizationBehaviorStuff() Uri myUri = new Uri("hello"); Uri[] addresses = new Uri[] { myUri }; Type c = typeof(HelloService); - ServiceHost serviceHost = new ServiceHost(c, addresses ); + ServiceHost serviceHost = new ServiceHost(c, addresses ); // // Code to create a ServiceHost not shown. - ServiceAuthorizationBehavior MyServiceAuthoriationBehavior = + ServiceAuthorizationBehavior MyServiceAuthoriationBehavior = serviceHost.Description.Behaviors.Find(); MyServiceAuthoriationBehavior.ImpersonateCallerForAllOperations = true; // // ChannelFactory cf = new ChannelFactory("EchoEndpoint"); - cf.Credentials.Windows.AllowedImpersonationLevel = + cf.Credentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation; // } diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_knowntypeattribute/cs/source.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_knowntypeattribute/cs/source.cs index 5db8a3b1b6e3e..1850348ad0b0d 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_knowntypeattribute/cs/source.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_knowntypeattribute/cs/source.cs @@ -127,30 +127,30 @@ public object Numbers public sealed class MathService { private MathService() { } - + // // This is in the service application code: static void Run() { - + MathOperationData md = new MathOperationData(); - // This will serialize and deserialize successfully because primitive + // This will serialize and deserialize successfully because primitive // types like int are always known. int a = 100; md.Numbers = a; - // This will serialize and deserialize successfully because the array of + // This will serialize and deserialize successfully because the array of // integers was added to known types. int[] b = new int[100]; md.Numbers = b; - // This will serialize and deserialize successfully because the generic + // This will serialize and deserialize successfully because the generic // List is equivalent to int[], which was added to known types. List c = new List(); md.Numbers = c; - // This will serialize but will not deserialize successfully because - // ArrayList is a non-generic collection, which is equivalent to + // This will serialize but will not deserialize successfully because + // ArrayList is a non-generic collection, which is equivalent to // an array of type object. To make it succeed, object[] // must be added to the known types. ArrayList d = new ArrayList(); @@ -158,7 +158,7 @@ static void Run() } // } - + public class Square { } public class Circle { } diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_maxclockskew/cs/source.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_maxclockskew/cs/source.cs index a046d6924708d..37c394de6a2ca 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_maxclockskew/cs/source.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_maxclockskew/cs/source.cs @@ -20,7 +20,7 @@ static void Main() } // - // This method returns a custom binding created from a WSHttpBinding. Alter the method + // This method returns a custom binding created from a WSHttpBinding. Alter the method // to use the appropriate binding for your service, with the appropriate settings. public static Binding CreateCustomBinding(TimeSpan clockSkew) { @@ -30,7 +30,7 @@ public static Binding CreateCustomBinding(TimeSpan clockSkew) myCustomBinding.Elements.Find(); security.LocalClientSettings.MaxClockSkew = clockSkew; security.LocalServiceSettings.MaxClockSkew = clockSkew; - // Get the System.ServiceModel.Security.Tokens.SecureConversationSecurityTokenParameters + // Get the System.ServiceModel.Security.Tokens.SecureConversationSecurityTokenParameters SecureConversationSecurityTokenParameters secureTokenParams = (SecureConversationSecurityTokenParameters)security.ProtectionTokenParameters; // From the collection, get the bootstrap element. @@ -40,12 +40,12 @@ public static Binding CreateCustomBinding(TimeSpan clockSkew) bootstrap.LocalServiceSettings.MaxClockSkew = clockSkew; return myCustomBinding; } - + private void Run() { - // Create a custom binding using the method defined above. The MaxClockSkew is set to 30 minutes. + // Create a custom binding using the method defined above. The MaxClockSkew is set to 30 minutes. Binding customBinding= CreateCustomBinding(TimeSpan.FromMinutes(30)); - + // Create a ServiceHost instance, and add a metadata endpoint. // NOTE When using Visual Studio, you must run as administrator. Uri baseUri = new Uri("http://localhost:1008/"); @@ -56,7 +56,7 @@ private void Run() // Add an endpoint using the binding, and open the service. sh.AddServiceEndpoint(typeof(ICalculator), customBinding, "myCalculator"); - + sh.Open(); Console.WriteLine("Listening..."); Console.ReadLine(); diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_principalpermissionattribute/cs/source.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_principalpermissionattribute/cs/source.cs index a30cc8978c480..0847256ea5e97 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_principalpermissionattribute/cs/source.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_principalpermissionattribute/cs/source.cs @@ -22,7 +22,7 @@ public double Add(double a, double b) // // - // Only a client authenticated with a valid certificate that has the + // Only a client authenticated with a valid certificate that has the // specified subject name and thumbprint can call this method. [PrincipalPermission(SecurityAction.Demand, Name = "CN=ReplaceWithSubjectName; 123456712345677E8E230FDE624F841B1CE9D41E")] @@ -45,13 +45,13 @@ public void WriteServiceSecurityContextData(string fileName) sw.WriteLine("WindowsIdentity: {0}", ServiceSecurityContext.Current.WindowsIdentity.Name); sw.WriteLine(); // Write the claimsets in the authorization context. By default, there is only one claimset - // provided by the system. + // provided by the system. foreach (ClaimSet claimset in ServiceSecurityContext.Current.AuthorizationContext.ClaimSets) { foreach (Claim claim in claimset) { // Write out each claim type, claim value, and the right. There are two - // possible values for the right: "identity" and "possessproperty". + // possible values for the right: "identity" and "possessproperty". sw.WriteLine("Claim Type = {0}", claim.ClaimType); sw.WriteLine("\t Resource = {0}", claim.Resource.ToString()); sw.WriteLine("\t Right = {0}", claim.Right); diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_programmingsecurity/cs/source.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_programmingsecurity/cs/source.cs index 4f9d7108c7630..6164c1fd944c1 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_programmingsecurity/cs/source.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_programmingsecurity/cs/source.cs @@ -58,7 +58,7 @@ private void snippet3() private void Snippet4() { // - // Specify client credentials on the client. + // Specify client credentials on the client. // Code to set the UserName and Password is not shown here. CalculatorClient CalculatorClient = new CalculatorClient("myBinding"); CalculatorClient.ClientCredentials.UserName.UserName = ReturnUserName(); @@ -90,7 +90,7 @@ private void Snippet6And7() // ServiceHost myServiceHost = new ServiceHost(typeof(CalculatorService)); - // Specify client credentials validation on the service. + // Specify client credentials validation on the service. ServiceCredentials myServiceCredentials = myServiceHost.Description.Behaviors.Find(); diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_protectionlevel/cs/source.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_protectionlevel/cs/source.cs index 3cd55e37c4d8f..49be8bddc4da0 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_protectionlevel/cs/source.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_protectionlevel/cs/source.cs @@ -52,7 +52,7 @@ public interface ICalculator ProtectionLevel = ProtectionLevel.EncryptAndSign)] double Add(double a, double b); } - // + // } namespace Samples3 { diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_referencingcertificatesconsistently/cs/source.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_referencingcertificatesconsistently/cs/source.cs index 6ec6b693ad580..00d354ca1be12 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_referencingcertificatesconsistently/cs/source.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_referencingcertificatesconsistently/cs/source.cs @@ -19,7 +19,7 @@ public Binding CreateClientBinding() WSSecurity10WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10); abe.SetKeyDerivation(false); - + X509SecurityTokenParameters istp = abe.InitiatorTokenParameters as X509SecurityTokenParameters; if (istp != null) @@ -35,9 +35,9 @@ public Binding CreateClientBinding() X509KeyIdentifierClauseType.IssuerSerial; } - HttpTransportBindingElement transport = + HttpTransportBindingElement transport = new HttpTransportBindingElement(); - + return new CustomBinding(abe, transport); } // diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_schemaimportexport/cs/source.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_schemaimportexport/cs/source.cs index 3ae7407846716..f8149d19522f4 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_schemaimportexport/cs/source.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_schemaimportexport/cs/source.cs @@ -12,7 +12,7 @@ [assembly: SecurityPermission(SecurityAction.RequestMinimum)] namespace ImportExport1 -{ +{ // [DataContract] public partial class Vehicle : IExtensibleDataObject @@ -28,7 +28,7 @@ [DataMember] public string color{ get {return this.colorField;} set {this.colorField=value;} } - + private ExtensionDataObject extensionDataField; public ExtensionDataObject ExtensionData { get {return this.extensionDataField;} @@ -54,7 +54,7 @@ [DataMember] internal string color{ get {return this.colorField;} set {this.colorField=value;} } - + private ExtensionDataObject extensionDataField; public ExtensionDataObject ExtensionData { get {return this.extensionDataField;} @@ -70,7 +70,7 @@ namespace Contoso.Cars { [DataContract] public partial class Vehicle : IExtensibleDataObject { - // Code not shown. + // Code not shown. public ExtensionDataObject ExtensionData { @@ -134,13 +134,13 @@ [DataMember] public string color{ } } } - + public event PropertyChangedEventHandler PropertyChanged; protected void RaisePropertyChanged (string propertyName) { - PropertyChangedEventHandler propertyChanged = + PropertyChangedEventHandler propertyChanged = this.PropertyChanged; if (propertyChanged != null) { - propertyChanged(this, + propertyChanged(this, new PropertyChangedEventArgs(propertyName)); } } @@ -196,5 +196,5 @@ public static void snippet() XsdDataContractImporter importer = new XsdDataContractImporter(); importer.Options.Namespaces.Add(new KeyValuePair("http://schemas.contoso.com/carSchema", "Contoso.Cars")); // - } + } } diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_securewindowsclient/cs/secureclient.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_securewindowsclient/cs/secureclient.cs index 3442b3766182e..a6f1c5d948d53 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_securewindowsclient/cs/secureclient.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_securewindowsclient/cs/secureclient.cs @@ -17,7 +17,7 @@ static void Main() // following this section WSHttpBinding b = new WSHttpBinding(SecurityMode.Message); b.Security.Message.ClientCredentialType = MessageCredentialType.Windows; - + EndpointAddress ea = new EndpointAddress("Http://localhost:8036/SecuritySamples/secureCalculator"); CalculatorClient cc = new CalculatorClient(b, ea); cc.Open(); @@ -40,7 +40,7 @@ static void Main2() // 4th Procedure: // Using config instead of the binding-related code // In this case, use a binding name from a configuration file generated by the - // SvcUtil.exe tool to create the client. Omit the binding and endpoint address + // SvcUtil.exe tool to create the client. Omit the binding and endpoint address // because that information is provided by the configuration file. CalculatorClient cc = new CalculatorClient("ICalculator_Binding"); diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_securewindowsservice/cs/secureservice.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_securewindowsservice/cs/secureservice.cs index f783fdc54b68a..a0d7c22f5a127 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_securewindowsservice/cs/secureservice.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_securewindowsservice/cs/secureservice.cs @@ -32,7 +32,7 @@ private void Run() // // 2nd Procedure: // Use the binding in a service - // Create the Type instances for later use and the URI for + // Create the Type instances for later use and the URI for // the base address. Type contractType = typeof(ICalculator); Type serviceType = typeof(Calculator); diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_securewithcertificate/cs/source.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_securewithcertificate/cs/source.cs index 95f899f3432f6..1b47587586ade 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_securewithcertificate/cs/source.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_securewithcertificate/cs/source.cs @@ -61,19 +61,19 @@ private void Run() Type contractType = typeof(ICalculator); Type implementedContract = typeof(Calculator); // - + // Uri baseAddress = new Uri("http://localhost:8044/base"); // - + // ServiceHost sh = new ServiceHost(implementedContract, baseAddress); // - + // sh.AddServiceEndpoint(contractType, b, "Calculator"); // - + // ServiceMetadataBehavior sm = new ServiceMetadataBehavior(); sm.HttpGetEnabled = true; diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_securityscenarios/cs/source.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_securityscenarios/cs/source.cs index d292eda400e18..7fe67c86bfaf3 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_securityscenarios/cs/source.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_securityscenarios/cs/source.cs @@ -55,7 +55,7 @@ public static void Run() Console.WriteLine("Press Enter to exit."); Console.ReadLine(); - // Close the service. + // Close the service. myServiceHost.Close(); // } @@ -69,20 +69,20 @@ public static void ClientRun() myBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic; - // Create the endpoint address. Note that the machine name + // Create the endpoint address. Note that the machine name // must match the subject or DNS field of the X.509 certificate - // used to authenticate the service. + // used to authenticate the service. EndpointAddress ea = new EndpointAddress("https://machineName/Calculator"); - // Create the client. The code for the calculator + // Create the client. The code for the calculator // client is not shown here. See the sample applications // for examples of the calculator code. CalculatorClient cc = new CalculatorClient(myBinding, ea); // The client must provide a user name and password. The code // to return the user name and password is not shown here. Use - // a database to store the user name and passwords, or use the + // a database to store the user name and passwords, or use the // ASP.NET Membership provider database. cc.ClientCredentials.UserName.UserName = ReturnUsername(); cc.ClientCredentials.UserName.Password = ReturnPassword(); @@ -169,7 +169,7 @@ public static void RunClient() EndpointAddress myEndpointAddress = new EndpointAddress("net.tcp://localhost:8008/Calculator"); - // Create the client. The code for the calculator client + // Create the client. The code for the calculator client // is not shown here. See the sample applications // for examples of the calculator code. CalculatorClient cc = @@ -247,20 +247,20 @@ public static void Run() public static void RunClient() { - // + // // Create the binding. WSHttpBinding myBinding = new WSHttpBinding(); myBinding.Security.Mode = SecurityMode.Transport; myBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None; - // Create the endpoint address. Note that the machine name + // Create the endpoint address. Note that the machine name // must match the subject or DNS field of the X.509 certificate - // used to authenticate the service. + // used to authenticate the service. EndpointAddress ea = new EndpointAddress("https://machineName/Calculator"); - // Create the client. The code for the calculator + // Create the client. The code for the calculator // client is not shown here. See the sample applications // for examples of the calculator code. CalculatorClient cc = @@ -303,7 +303,7 @@ public class MyService public static void Run() { // - // Create the binding. + // Create the binding. WSHttpBinding binding = new WSHttpBinding(); binding.Security.Mode = SecurityMode.Transport; binding.Security.Transport.ClientCredentialType = HttpClientCredentialType. @@ -337,13 +337,13 @@ private void ClientRun() myBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Certificate; - // Create the endpoint address. Note that the machine name + // Create the endpoint address. Note that the machine name // must match the subject or DNS field of the X.509 certificate - // used to authenticate the service. + // used to authenticate the service. EndpointAddress ea = new EndpointAddress("https://localhost:8006/Calculator"); - // Create the client. The code for the calculator + // Create the client. The code for the calculator // client is not shown here. See the sample applications // for examples of the calculator code. CalculatorClient cc = @@ -392,7 +392,7 @@ public class SecureService public static void Run() { // - // Create the binding. + // Create the binding. WSHttpBinding binding = new WSHttpBinding(); binding.Security.Mode = SecurityMode.Message; binding.Security.Message.ClientCredentialType = @@ -433,11 +433,11 @@ private void ClientRun() myBinding.Security.Message.ClientCredentialType = MessageCredentialType.None; - // Create the endpoint address. + // Create the endpoint address. EndpointAddress ea = new EndpointAddress("http://localhost/Calculator"); - // Create the client. + // Create the client. CalculatorClient cc = new CalculatorClient(myBinding, ea); @@ -504,7 +504,7 @@ public static void Run() Console.WriteLine("Listening..."); Console.ReadLine(); - // Close the service. + // Close the service. myServiceHost.Close(); // } @@ -518,15 +518,15 @@ private void ClientRun() myBinding.Security.Message.ClientCredentialType = MessageCredentialType.UserName; - // Create the endpoint address. + // Create the endpoint address. EndpointAddress ea = new EndpointAddress("http://machineName/Calculator"); - // Create the client. + // Create the client. CalculatorClient cc = new CalculatorClient(myBinding, ea); - // Set the user name and password. The code to + // Set the user name and password. The code to // return the user name and password is not shown here. Use // an interface to query the user for the information. cc.ClientCredentials.UserName.UserName = ReturnUsername(); @@ -618,11 +618,11 @@ private void ClientRun() myBinding.Security.Message.ClientCredentialType = MessageCredentialType.Certificate; - // Create the endpoint address. + // Create the endpoint address. EndpointAddress ea = new EndpointAddress("http://machineName/Calculator"); - // Create the client. + // Create the client. CalculatorClient cc = new CalculatorClient(myBinding, ea); @@ -686,7 +686,7 @@ public static void Run() myServiceHost.AddServiceEndpoint( typeof(ICalculator), binding, ""); - // Open the service. + // Open the service. myServiceHost.Open(); Console.WriteLine("Listening ...."); Console.ReadLine(); @@ -705,11 +705,11 @@ private void ClientRun() myBinding.Security.Message.ClientCredentialType = MessageCredentialType.Windows; - // Create the endpoint address. + // Create the endpoint address. EndpointAddress ea = new EndpointAddress("net.tcp://machineName:8008/Calculator"); - // Create the client. + // Create the client. CalculatorClient cc = new CalculatorClient(myBinding, ea); @@ -788,7 +788,7 @@ public static void Run() Console.WriteLine("Listening..."); Console.ReadLine(); - // Close the service. + // Close the service. myServiceHost.Close(); // } @@ -802,7 +802,7 @@ private void ClientRun() myBinding.Security.Message.ClientCredentialType = MessageCredentialType.Windows; - // Disable credential negotiation and the establishment of + // Disable credential negotiation and the establishment of // a security context. myBinding.Security.Message.NegotiateServiceCredential = false; myBinding.Security.Message.EstablishSecurityContext = false; @@ -816,7 +816,7 @@ private void ClientRun() new Uri("http://machineName/Calculator"), EndpointIdentity.CreateSpnIdentity("service_spn_name")); - // Create the client. + // Create the client. CalculatorClient cc = new CalculatorClient(myBinding, ea); @@ -859,7 +859,7 @@ public class MyService public static void Run() { // - // Create the binding. + // Create the binding. WSHttpBinding binding = new WSHttpBinding(); binding.Security.Mode = SecurityMode.Message; binding.Security.Message.ClientCredentialType = @@ -902,16 +902,16 @@ private void ClientRun() myBinding.Security.Message.ClientCredentialType = MessageCredentialType.Certificate; - // Disable credential negotiation and the establishment of + // Disable credential negotiation and the establishment of // a security context. myBinding.Security.Message.NegotiateServiceCredential = false; myBinding.Security.Message.EstablishSecurityContext = false; - // Create the endpoint address. + // Create the endpoint address. EndpointAddress ea = new EndpointAddress("http://machineName/Calculator"); - // Create the client. + // Create the client. CalculatorClient cc = new CalculatorClient(myBinding, ea); diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_settingsecuritymode/cs/source.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_settingsecuritymode/cs/source.cs index 4dd5a2080f037..88dc5112f9e50 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_settingsecuritymode/cs/source.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_settingsecuritymode/cs/source.cs @@ -109,7 +109,7 @@ private void TcpMessageWithCredentialWindows() ServiceHost sh = new ServiceHost(typeof(Calculator), netTcpAdddress); sh.Credentials.ServiceCertificate.SetCertificate( StoreLocation.LocalMachine, StoreName.My, - X509FindType.FindByIssuerName, "Contoso.com"); + X509FindType.FindByIssuerName, "Contoso.com"); sh.AddServiceEndpoint(typeof(ICalculator), b, "TcpCalculator"); sh.Open(); Console.WriteLine("Listening"); diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_signatureconfirmation/cs/source.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_signatureconfirmation/cs/source.cs index 2cbecc629311d..d62fe15884f35 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_signatureconfirmation/cs/source.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_signatureconfirmation/cs/source.cs @@ -21,7 +21,7 @@ private Binding CreateBinding() { BindingElementCollection bindings = new BindingElementCollection(); KerberosSecurityTokenParameters tokens = new KerberosSecurityTokenParameters(); - SymmetricSecurityBindingElement security = + SymmetricSecurityBindingElement security = new SymmetricSecurityBindingElement(tokens); // Require that every request and return be correlated. diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_simpleimpersonation/cs/source.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_simpleimpersonation/cs/source.cs index c264ce7e51e0a..79a4270040fec 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_simpleimpersonation/cs/source.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_simpleimpersonation/cs/source.cs @@ -8,7 +8,7 @@ SecurityAction.RequestMinimum, Execution = true)] namespace ProxySample { - + public class Test { static void Main() @@ -21,7 +21,7 @@ private void Impersonation() private void ClientCode() { - // + // CalculatorClient client = new CalculatorClient("CalculatorEndpoint"); client.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation; diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_supportingcredential/cs/source.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_supportingcredential/cs/source.cs index 57e7287718355..ac28d72bb36fa 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_supportingcredential/cs/source.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_supportingcredential/cs/source.cs @@ -42,15 +42,15 @@ private SecurityBindingElement CreateSecurityBindingElement() SymmetricSecurityBindingElement secBindingEle = SecurityBindingElement.CreateIssuedTokenBindingElement(issuedSecTok); - // Create a Kerberos token parameter object and set the inclusion - // mode to AlwaysToRecipient. Add the object as an endorsing token for + // Create a Kerberos token parameter object and set the inclusion + // mode to AlwaysToRecipient. Add the object as an endorsing token for // all operations of the endpoint. KerberosSecurityTokenParameters kstp = new KerberosSecurityTokenParameters(); kstp.InclusionMode = SecurityTokenInclusionMode.AlwaysToRecipient; secBindingEle.EndpointSupportingTokenParameters.Endorsing.Add(kstp); - // Create a username token parameter object and set its - // RequireDerivedKeys to false. + // Create a username token parameter object and set its + // RequireDerivedKeys to false. UserNameSecurityTokenParameters userNameParams = new UserNameSecurityTokenParameters(); userNameParams.RequireDerivedKeys = false; @@ -63,7 +63,7 @@ private SecurityBindingElement CreateSecurityBindingElement() stp.SignedEncrypted.Add(userNameParams); // Create a generic dictionary item, a KeyValuePair object - // that includes all supporting token parameters. Then add + // that includes all supporting token parameters. Then add // it to the dictionary for operation-scope supporting tokens. KeyValuePair x = new KeyValuePair("1", stp); @@ -91,7 +91,7 @@ public static Binding CreateMultiFactorAuthenticationBinding() // 1) A user name/password encrypted with the service token. // 2) A client certificate used to sign the message. - // Instantiate a binding element that will require the user name/password token + // Instantiate a binding element that will require the user name/password token // in the message (encrypted with the server certificate). SymmetricSecurityBindingElement messageSecurity = SecurityBindingElement.CreateUserNameForCertificateBindingElement(); @@ -101,7 +101,7 @@ public static Binding CreateMultiFactorAuthenticationBinding() clientX509SupportingTokenParameters.InclusionMode = SecurityTokenInclusionMode.AlwaysToRecipient; // Turn off derived keys. clientX509SupportingTokenParameters.RequireDerivedKeys = false; - // Augment the binding element to require the client's X.509 certificate as an + // Augment the binding element to require the client's X.509 certificate as an // endorsing token in the message. messageSecurity.EndpointSupportingTokenParameters.Endorsing.Add(clientX509SupportingTokenParameters); diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_syncasyncclient/cs/client.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_syncasyncclient/cs/client.cs index d9088a9d646ac..ad1f46690eb0e 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_syncasyncclient/cs/client.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_syncasyncclient/cs/client.cs @@ -1,7 +1,7 @@ // using System; using System.ServiceModel; - + public class Client { @@ -42,7 +42,7 @@ void Run() Console.WriteLine("Press ENTER to exit:"); Console.ReadLine(); - // Done with service. + // Done with service. wcfClient.Close(); Console.WriteLine("Done!"); } diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_syncasyncclient/cs/proxycode.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_syncasyncclient/cs/proxycode.cs index 1cb7ebc52425e..3d1d4ce22dc3f 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_syncasyncclient/cs/proxycode.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_syncasyncclient/cs/proxycode.cs @@ -12,38 +12,38 @@ [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")] [System.ServiceModel.ServiceContractAttribute( - Namespace="http://microsoft.wcf.documentation", + Namespace="http://microsoft.wcf.documentation", ConfigurationName="ISampleService" )] public interface ISampleService { - + [System.ServiceModel.OperationContractAttribute( - Action="http://microsoft.wcf.documentation/ISampleService/SampleMethod", + Action="http://microsoft.wcf.documentation/ISampleService/SampleMethod", ReplyAction="http://microsoft.wcf.documentation/ISampleService/SampleMethodResponse" )] string SampleMethod(string msg); - + [System.ServiceModel.OperationContractAttribute( - AsyncPattern=true, - Action="http://microsoft.wcf.documentation/ISampleService/SampleMethod", + AsyncPattern=true, + Action="http://microsoft.wcf.documentation/ISampleService/SampleMethod", ReplyAction="http://microsoft.wcf.documentation/ISampleService/SampleMethodResponse" )] System.IAsyncResult BeginSampleMethod(string msg, System.AsyncCallback callback, object asyncState); - + string EndSampleMethod(System.IAsyncResult result); - + [System.ServiceModel.OperationContractAttribute( - Action="http://microsoft.wcf.documentation/ISampleService/ServiceAsyncMethod", + Action="http://microsoft.wcf.documentation/ISampleService/ServiceAsyncMethod", ReplyAction="http://microsoft.wcf.documentation/ISampleService/ServiceAsyncMethodResponse")] string ServiceAsyncMethod(string msg); - + [System.ServiceModel.OperationContractAttribute( - AsyncPattern=true, - Action="http://microsoft.wcf.documentation/ISampleService/ServiceAsyncMethod", + AsyncPattern=true, + Action="http://microsoft.wcf.documentation/ISampleService/ServiceAsyncMethod", ReplyAction="http://microsoft.wcf.documentation/ISampleService/ServiceAsyncMethodResponse")] System.IAsyncResult BeginServiceAsyncMethod(string msg, System.AsyncCallback callback, object asyncState); - + string EndServiceAsyncMethod(System.IAsyncResult result); } @@ -56,56 +56,56 @@ public interface ISampleServiceChannel : ISampleService, System.ServiceModel.ICl [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")] public partial class SampleServiceClient : System.ServiceModel.ClientBase, ISampleService { - + public SampleServiceClient() { } - - public SampleServiceClient(string endpointConfigurationName) : + + public SampleServiceClient(string endpointConfigurationName) : base(endpointConfigurationName) { } - - public SampleServiceClient(string endpointConfigurationName, string remoteAddress) : + + public SampleServiceClient(string endpointConfigurationName, string remoteAddress) : base(endpointConfigurationName, remoteAddress) { } - - public SampleServiceClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : + + public SampleServiceClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : base(endpointConfigurationName, remoteAddress) { } - - public SampleServiceClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : + + public SampleServiceClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : base(binding, remoteAddress) { } - + public string SampleMethod(string msg) { return base.Channel.SampleMethod(msg); } - + public System.IAsyncResult BeginSampleMethod(string msg, System.AsyncCallback callback, object asyncState) { return base.Channel.BeginSampleMethod(msg, callback, asyncState); } - + public string EndSampleMethod(System.IAsyncResult result) { return base.Channel.EndSampleMethod(result); } - + public string ServiceAsyncMethod(string msg) { return base.Channel.ServiceAsyncMethod(msg); } - + public System.IAsyncResult BeginServiceAsyncMethod(string msg, System.AsyncCallback callback, object asyncState) { return base.Channel.BeginServiceAsyncMethod(msg, callback, asyncState); } - + public string EndServiceAsyncMethod(System.IAsyncResult result) { return base.Channel.EndServiceAsyncMethod(result); diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_syncasyncclient/cs/services.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_syncasyncclient/cs/services.cs index 2feba1f5d6e3b..b0b752698f4cb 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_syncasyncclient/cs/services.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_syncasyncclient/cs/services.cs @@ -40,7 +40,7 @@ public string SampleMethod(string msg) return "The sychronous service greets you: " + msg; } - // This asynchronously implemented operation is never called because + // This asynchronously implemented operation is never called because // there is a synchronous version of the same method. public IAsyncResult BeginSampleMethod(string msg, AsyncCallback callback, object asyncState) { @@ -56,7 +56,7 @@ public string EndSampleMethod(IAsyncResult r) } // - public IAsyncResult BeginServiceAsyncMethod(string msg, AsyncCallback callback, object asyncState) + public IAsyncResult BeginServiceAsyncMethod(string msg, AsyncCallback callback, object asyncState) { Console.WriteLine("BeginServiceAsyncMethod called with: \"{0}\"", msg); return new CompletedAsyncResult(msg); diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_tcpclient/cs/source.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_tcpclient/cs/source.cs index 9b514ee96b31f..7005c56dac866 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_tcpclient/cs/source.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_tcpclient/cs/source.cs @@ -74,7 +74,7 @@ private void SecureHttp() { // // Create a WSHttpBinding and set its security properties. The - // security mode is Message, and the client is authenticated with + // security mode is Message, and the client is authenticated with // a certificate. EndpointAddress ea = new EndpointAddress("http://contoso.com/"); WSHttpBinding b = new WSHttpBinding(); @@ -97,7 +97,7 @@ private void SetCertificate_SubjectName() { // // Create a WSHttpBinding and set its security properties. The - // security mode is Message, and the client is authenticated with + // security mode is Message, and the client is authenticated with // a certificate. EndpointAddress ea = new EndpointAddress("http://contoso.com/"); WSHttpBinding b = new WSHttpBinding(); @@ -111,7 +111,7 @@ private void SetCertificate_SubjectName() // Set the client credential value to a valid certificate. cc.ClientCredentials.ClientCertificate.SetCertificate( "CN=MyName, OU=MyOrgUnit, C=US", - StoreLocation.CurrentUser, + StoreLocation.CurrentUser, StoreName.TrustedPeople); // } diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_tcpservice/cs/source.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_tcpservice/cs/source.cs index 597e13cb4e392..961a5c268133b 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_tcpservice/cs/source.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_tcpservice/cs/source.cs @@ -48,8 +48,8 @@ private void TcpTransportCert() // shown here. ServiceHost sh = new ServiceHost(typeof(Calculator), baseAddresses); - // Add an endpoint to the service. Insert the thumbprint of an X.509 - // certificate found on your computer. + // Add an endpoint to the service. Insert the thumbprint of an X.509 + // certificate found on your computer. Type c = typeof(ICalculator); sh.AddServiceEndpoint(c, b, "MyCalculator"); sh.Credentials.ServiceCertificate.SetCertificate( @@ -61,7 +61,7 @@ private void TcpTransportCert() // This next line is optional. It specifies that the client's certificate // does not have to be issued by a trusted authority, but can be issued // by a peer if it is in the Trusted People store. Do not use this setting - // for production code. The default is PeerTrust, which specifies that + // for production code. The default is PeerTrust, which specifies that // the certificate must originate from a trusted certificate authority. // sh.Credentials.ClientCertificate.Authentication.CertificateValidationMode = @@ -117,8 +117,8 @@ private void TcpMessageCert() // shown here. ServiceHost sh = new ServiceHost(typeof(Calculator), baseAddresses); - // Add an endpoint to the service. The code to define the service - // type (ICalculator) is not shown here. The code also requires + // Add an endpoint to the service. The code to define the service + // type (ICalculator) is not shown here. The code also requires // you to insert the thumbprint of an X.509 certificate on your // computer. The SetCertificate method specifies where the certificate // is stored, and how to find it, as well as the value to find. @@ -200,7 +200,7 @@ private void RunClient() // Create a binding using Transport and a certificate. NetTcpBinding b = new NetTcpBinding(); b.Security.Mode = SecurityMode.Transport; - b.Security.Transport.ClientCredentialType = + b.Security.Transport.ClientCredentialType = TcpClientCredentialType.Certificate; // Create an EndPointAddress. @@ -232,7 +232,7 @@ private void RunClient() { Console.WriteLine(exc.Message); Console.ReadLine(); - } + } // } } diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_unsecuredclient/cs/source.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_unsecuredclient/cs/source.cs index 5d6c0d3d4891a..ee446f7bf0574 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_unsecuredclient/cs/source.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_unsecuredclient/cs/source.cs @@ -21,7 +21,7 @@ static void Main(string[] args) private void UnsecuredHttp() { // - // Create an instance of the BasicHttpBinding. + // Create an instance of the BasicHttpBinding. // By default, there is no security. BasicHttpBinding myBinding = new BasicHttpBinding(); diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_unsecuredservice/cs/source.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_unsecuredservice/cs/source.cs index 7e50b3d515585..e204a9aad8bc5 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_unsecuredservice/cs/source.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_unsecuredservice/cs/source.cs @@ -28,7 +28,7 @@ private void UnsecuredHttp() // Create the ServiceHost. ServiceHost myServiceHost = new ServiceHost(typeof(Calculator), httpUri); - // Create a binding that uses HTTP. By default, + // Create a binding that uses HTTP. By default, // this binding has no security. BasicHttpBinding b = new BasicHttpBinding(); @@ -48,7 +48,7 @@ private void UnsecuredTcp() { // Uri tcpUri = new Uri("net.tcp://localhost:8008/Calculator"); - + // Create the ServiceHost. ServiceHost sh = new ServiceHost(typeof(Calculator), tcpUri); diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_usingthemessageclass/cs/source.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_usingthemessageclass/cs/source.cs index 5ad2d9d732595..4c730a92c752c 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_usingthemessageclass/cs/source.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_usingthemessageclass/cs/source.cs @@ -61,9 +61,9 @@ public Message GetData() { FileStream stream = new FileStream("myfile.xml",FileMode.Open); XmlDictionaryReader xdr = - XmlDictionaryReader.CreateTextReader(stream, + XmlDictionaryReader.CreateTextReader(stream, new XmlDictionaryReaderQuotas()); - MessageVersion ver = + MessageVersion ver = OperationContext.Current.IncomingMessageVersion; return Message.CreateMessage(ver,"GetDataResponse",xdr); } @@ -88,7 +88,7 @@ public Message GetData() public void PutData(Message m) { // Not implemented. - } + } } // @@ -157,14 +157,14 @@ public void ForwardMessage (Message m) { //Copy the message to a buffer. MessageBuffer mb = m.CreateBufferedCopy(65536); - + //Forward to multiple recipients. foreach (IOutputChannel channel in forwardingAddresses) { Message copy = mb.CreateMessage(); channel.Send(copy); } - + //Log to a file. FileStream stream = new FileStream("log.xml",FileMode.Append); mb.WriteMessage(stream); @@ -203,7 +203,7 @@ override protected void OnWriteBodyContents(XmlDictionaryWriter writer) writer.WriteValue(r.Next(1,20)); writer.WriteEndElement(); } - } + } //code omitted… // @@ -230,28 +230,28 @@ override protected XmlDictionaryReader OnGetReaderAtBodyContents() { return new RandomNumbersXmlReader(); } - + override protected void OnWriteBodyContents(XmlDictionaryWriter writer) { XmlDictionaryReader xdr = OnGetReaderAtBodyContents(); - writer.WriteNode(xdr, true); - } + writer.WriteNode(xdr, true); + } public override MessageHeaders Headers { get { throw new Exception("The method or operation is not implemented."); } } - + public override MessageProperties Properties { get { throw new Exception("The method or operation is not implemented."); } } - + public override MessageVersion Version { get { throw new Exception("The method or operation is not implemented."); } } } - + public class RandomNumbersXmlReader : XmlDictionaryReader { //code to serve up 100000 random numbers in XML form omitted… diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_wcfclienttowseservice/cs/generatedclient.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_wcfclienttowseservice/cs/generatedclient.cs index 40aa797908451..446b0848d8cff 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_wcfclienttowseservice/cs/generatedclient.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_wcfclienttowseservice/cs/generatedclient.cs @@ -11,75 +11,75 @@ namespace Microsoft.ServiceModel.Samples { - - + + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")] [System.ServiceModel.ServiceContractAttribute(Namespace="http://Microsoft.ServiceModel.Samples", ConfigurationName="Microsoft.ServiceModel.Samples.ICalculator")] public interface ICalculator { - + [System.ServiceModel.OperationContractAttribute(Action="http://Microsoft.ServiceModel.Samples/ICalculator/Add", ReplyAction="http://Microsoft.ServiceModel.Samples/ICalculator/AddResponse")] double Add(double n1, double n2); - + [System.ServiceModel.OperationContractAttribute(Action="http://Microsoft.ServiceModel.Samples/ICalculator/Subtract", ReplyAction="http://Microsoft.ServiceModel.Samples/ICalculator/SubtractResponse")] double Subtract(double n1, double n2); - + [System.ServiceModel.OperationContractAttribute(Action="http://Microsoft.ServiceModel.Samples/ICalculator/Multiply", ReplyAction="http://Microsoft.ServiceModel.Samples/ICalculator/MultiplyResponse")] double Multiply(double n1, double n2); - + [System.ServiceModel.OperationContractAttribute(Action="http://Microsoft.ServiceModel.Samples/ICalculator/Divide", ReplyAction="http://Microsoft.ServiceModel.Samples/ICalculator/DivideResponse")] double Divide(double n1, double n2); } - + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")] public interface ICalculatorChannel : Microsoft.ServiceModel.Samples.ICalculator, System.ServiceModel.IClientChannel { } - + [System.Diagnostics.DebuggerStepThroughAttribute()] [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")] public partial class CalculatorClient : System.ServiceModel.ClientBase, Microsoft.ServiceModel.Samples.ICalculator { - + public CalculatorClient() { } - - public CalculatorClient(string endpointConfigurationName) : + + public CalculatorClient(string endpointConfigurationName) : base(endpointConfigurationName) { } - - public CalculatorClient(string endpointConfigurationName, string remoteAddress) : + + public CalculatorClient(string endpointConfigurationName, string remoteAddress) : base(endpointConfigurationName, remoteAddress) { } - - public CalculatorClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : + + public CalculatorClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : base(endpointConfigurationName, remoteAddress) { } - - public CalculatorClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : + + public CalculatorClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : base(binding, remoteAddress) { } - + public double Add(double n1, double n2) { return base.Channel.Add(n1, n2); } - + public double Subtract(double n1, double n2) { return base.Channel.Subtract(n1, n2); } - + public double Multiply(double n1, double n2) { return base.Channel.Multiply(n1, n2); } - + public double Divide(double n1, double n2) { return base.Channel.Divide(n1, n2); diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_wcfclienttowseservice/cs/wseclient.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_wcfclienttowseservice/cs/wseclient.cs index 5715d50becc8c..6dc27bd954a96 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_wcfclienttowseservice/cs/wseclient.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_wcfclienttowseservice/cs/wseclient.cs @@ -18,35 +18,35 @@ [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://stockservice.contoso.com/wse/samples/2003/06")] public partial class StockQuote { - + private string symbolField; - + private double lastField; - + private System.DateTime dateField; - + private double changeField; - + private double openField; - + private double highField; - + private double lowField; - + private long volumeField; - + private long marketCapField; - + private double previousCloseField; - + private double previousChangeField; - + private double low52WeekField; - + private double high52WeekField; - + private string nameField; - + /// [System.Xml.Serialization.XmlElementAttribute(Order=0)] public string Symbol @@ -60,7 +60,7 @@ public string Symbol this.symbolField = value; } } - + /// [System.Xml.Serialization.XmlElementAttribute(Order=1)] public double Last @@ -74,7 +74,7 @@ public double Last this.lastField = value; } } - + /// [System.Xml.Serialization.XmlElementAttribute(Order=2)] public System.DateTime Date @@ -88,7 +88,7 @@ public System.DateTime Date this.dateField = value; } } - + /// [System.Xml.Serialization.XmlElementAttribute(Order=3)] public double Change @@ -102,7 +102,7 @@ public double Change this.changeField = value; } } - + /// [System.Xml.Serialization.XmlElementAttribute(Order=4)] public double Open @@ -116,7 +116,7 @@ public double Open this.openField = value; } } - + /// [System.Xml.Serialization.XmlElementAttribute(Order=5)] public double High @@ -130,7 +130,7 @@ public double High this.highField = value; } } - + /// [System.Xml.Serialization.XmlElementAttribute(Order=6)] public double Low @@ -144,7 +144,7 @@ public double Low this.lowField = value; } } - + /// [System.Xml.Serialization.XmlElementAttribute(Order=7)] public long Volume @@ -158,7 +158,7 @@ public long Volume this.volumeField = value; } } - + /// [System.Xml.Serialization.XmlElementAttribute(Order=8)] public long MarketCap @@ -172,7 +172,7 @@ public long MarketCap this.marketCapField = value; } } - + /// [System.Xml.Serialization.XmlElementAttribute(Order=9)] public double PreviousClose @@ -186,7 +186,7 @@ public double PreviousClose this.previousCloseField = value; } } - + /// [System.Xml.Serialization.XmlElementAttribute(Order=10)] public double PreviousChange @@ -200,7 +200,7 @@ public double PreviousChange this.previousChangeField = value; } } - + /// [System.Xml.Serialization.XmlElementAttribute(Order=11)] public double Low52Week @@ -214,7 +214,7 @@ public double Low52Week this.low52WeekField = value; } } - + /// [System.Xml.Serialization.XmlElementAttribute(Order=12)] public double High52Week @@ -228,7 +228,7 @@ public double High52Week this.high52WeekField = value; } } - + /// [System.Xml.Serialization.XmlElementAttribute(Order=13)] public string Name @@ -250,7 +250,7 @@ public string Name [System.ServiceModel.ServiceContractAttribute(Namespace="http://stockservice.contoso.com/wse/samples/2005/10", ConfigurationName="WSSecurityAnonymousServiceSoap")] public interface WSSecurityAnonymousServiceSoap { - + // CODEGEN: Generating message contract since the wrapper name (StockQuotes) of message StockQuoteRequestResponse does not match the default value (StockQuoteRequest) [System.ServiceModel.OperationContractAttribute(Action="http://stockservice.contoso.com/wse/samples/2005/10/StockQuoteRequest", ReplyAction="*")] [System.ServiceModel.XmlSerializerFormatAttribute()] @@ -266,36 +266,36 @@ public interface WSSecurityAnonymousServiceSoapChannel : WSSecurityAnonymousServ [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")] public partial class WSSecurityAnonymousServiceSoapClient : System.ServiceModel.ClientBase, WSSecurityAnonymousServiceSoap { - + public WSSecurityAnonymousServiceSoapClient() { } - - public WSSecurityAnonymousServiceSoapClient(string endpointConfigurationName) : + + public WSSecurityAnonymousServiceSoapClient(string endpointConfigurationName) : base(endpointConfigurationName) { } - - public WSSecurityAnonymousServiceSoapClient(string endpointConfigurationName, string remoteAddress) : + + public WSSecurityAnonymousServiceSoapClient(string endpointConfigurationName, string remoteAddress) : base(endpointConfigurationName, remoteAddress) { } - - public WSSecurityAnonymousServiceSoapClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : + + public WSSecurityAnonymousServiceSoapClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : base(endpointConfigurationName, remoteAddress) { } - - public WSSecurityAnonymousServiceSoapClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : + + public WSSecurityAnonymousServiceSoapClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : base(binding, remoteAddress) { } - + StockQuoteRequestResponse WSSecurityAnonymousServiceSoap.StockQuoteRequest(StockQuoteRequestRequest request) { return base.Channel.StockQuoteRequest(request); } - + public StockQuote[] StockQuoteRequest(string[] symbols) { StockQuoteRequestRequest inValue = new StockQuoteRequestRequest(); @@ -311,16 +311,16 @@ public StockQuote[] StockQuoteRequest(string[] symbols) [System.ServiceModel.MessageContractAttribute(WrapperName="StockQuoteRequest", WrapperNamespace="http://stockservice.contoso.com/wse/samples/2005/10", IsWrapped=true)] public partial class StockQuoteRequestRequest { - + [System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://stockservice.contoso.com/wse/samples/2005/10", Order=0)] [System.Xml.Serialization.XmlArrayAttribute(IsNullable=true)] [System.Xml.Serialization.XmlArrayItemAttribute("Symbol", IsNullable=false)] public string[] symbols; - + public StockQuoteRequestRequest() { } - + public StockQuoteRequestRequest(string[] symbols) { this.symbols = symbols; @@ -332,15 +332,15 @@ public StockQuoteRequestRequest(string[] symbols) [System.ServiceModel.MessageContractAttribute(WrapperName="StockQuotes", WrapperNamespace="http://stockservice.contoso.com/wse/samples/2005/10", IsWrapped=true)] public partial class StockQuoteRequestResponse { - + [System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://stockservice.contoso.com/wse/samples/2005/10", Order=0)] [System.Xml.Serialization.XmlElementAttribute("StockQuote")] public StockQuote[] StockQuote; - + public StockQuoteRequestResponse() { } - + public StockQuoteRequestResponse(StockQuote[] StockQuote) { this.StockQuote = StockQuote; diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_wcfclienttowseservice/cs/wsehttpbinding.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_wcfclienttowseservice/cs/wsehttpbinding.cs index fd4dc9bc22873..94fda7e2575a6 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_wcfclienttowseservice/cs/wsehttpbinding.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_wcfclienttowseservice/cs/wsehttpbinding.cs @@ -50,7 +50,7 @@ public override BindingElementCollection CreateBindingElements() case WseSecurityAssertion.UsernameForCertificate: transport = new HttpTransportBindingElement(); securityBinding = (SymmetricSecurityBindingElement)SecurityBindingElement.CreateUserNameForCertificateBindingElement(); - // We want signatureconfirmation on the bootstrap process + // We want signatureconfirmation on the bootstrap process // either for the application messages or for the RST/RSTR ((SymmetricSecurityBindingElement)securityBinding).RequireSignatureConfirmation = requireSignatureConfirmation; ((SymmetricSecurityBindingElement)securityBinding).MessageProtectionOrder = messageProtectionOrder; @@ -83,7 +83,7 @@ public override BindingElementCollection CreateBindingElements() // set the preference for derived keys before creating SecureConversationBindingElement securityBinding.SetKeyDerivation(requireDerivedKeys); - //Secure Conversation + //Secure Conversation if (establishSecurityContext == true) { SymmetricSecurityBindingElement secureconversation = @@ -94,7 +94,7 @@ public override BindingElementCollection CreateBindingElements() //Set defaults for the secure conversation binding secureconversation.DefaultAlgorithmSuite = SecurityAlgorithmSuite.Basic256; - // We do not want signature confirmation on the application level messages + // We do not want signature confirmation on the application level messages // when secure conversation is enabled. secureconversation.RequireSignatureConfirmation = false; secureconversation.MessageProtectionOrder = messageProtectionOrder; @@ -105,7 +105,7 @@ public override BindingElementCollection CreateBindingElements() // Add the security binding to the binding collection bec.Add(securityBinding); - // Add the message encoder. + // Add the message encoder. TextMessageEncodingBindingElement textelement = new TextMessageEncodingBindingElement(); textelement.MessageVersion = MessageVersion.Soap11WSAddressingAugust2004; //These are the defaults required for WSE diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_wshttpservice/cs/source.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_wshttpservice/cs/source.cs index 78235c865a2b3..07b0e18b2afd9 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_wshttpservice/cs/source.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_wshttpservice/cs/source.cs @@ -9,7 +9,7 @@ namespace WsHttp { class Service - { + { private void Basic() { // @@ -58,8 +58,8 @@ private void WSHttpTransportCert() // shown here. ServiceHost sh = new ServiceHost(typeof(Calculator), baseAddresses); - // Add an endpoint to the service. Insert the thumbprint of an X.509 - // certificate found on your computer. + // Add an endpoint to the service. Insert the thumbprint of an X.509 + // certificate found on your computer. Type c = typeof(ICalculator); sh.AddServiceEndpoint(c, b, "MyCalculator"); sh.Credentials.ServiceCertificate.SetCertificate( @@ -71,7 +71,7 @@ private void WSHttpTransportCert() // This next line is optional. It specifies that the client's certificate // does not have to be issued by a trusted authority, but can be issued // by a peer if it is in the Trusted People store. Do not use this setting - // for production code. The default is PeerTrust, which specifies that + // for production code. The default is PeerTrust, which specifies that // the certificate must originate from a trusted certificate authority. // sh.Credentials.ClientCertificate.Authentication.CertificateValidationMode = diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_xmlserializer/cs/source.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_xmlserializer/cs/source.cs index 93952fd0404af..84abafc55b2af 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_xmlserializer/cs/source.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_xmlserializer/cs/source.cs @@ -95,7 +95,7 @@ public class BankingTransaction namespace UsingXml3 { using UsingXml1; - + // [MessageContract] public class BankingTransaction @@ -103,13 +103,13 @@ public class BankingTransaction [MessageHeader] public string Operation; //This element will be and not : - [XmlElement(ElementName="fromAcct"), MessageBodyMember(Name="from")] + [XmlElement(ElementName="fromAcct"), MessageBodyMember(Name="from")] public Account fromAccount; - - [XmlElement, MessageBodyMember] + + [XmlElement, MessageBodyMember] public Account toAccount; - - [XmlAttribute, MessageBodyMember] + + [XmlAttribute, MessageBodyMember] public int amount; } // diff --git a/samples/snippets/csharp/VS_Snippets_CFX/callbackbehaviorattribute/cs/client.cs b/samples/snippets/csharp/VS_Snippets_CFX/callbackbehaviorattribute/cs/client.cs index e4f93544300ee..fbcf80734f524 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/callbackbehaviorattribute/cs/client.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/callbackbehaviorattribute/cs/client.cs @@ -7,7 +7,7 @@ namespace Microsoft.WCF.Documentation { [CallbackBehaviorAttribute( - IncludeExceptionDetailInFaults= true, + IncludeExceptionDetailInFaults= true, UseSynchronizationContext=true, ValidateMustUnderstand=true )] diff --git a/samples/snippets/csharp/VS_Snippets_CFX/callbackbehaviorattribute/cs/proxycode.cs b/samples/snippets/csharp/VS_Snippets_CFX/callbackbehaviorattribute/cs/proxycode.cs index 56df4e88dff94..d01e6d09795c1 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/callbackbehaviorattribute/cs/proxycode.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/callbackbehaviorattribute/cs/proxycode.cs @@ -14,7 +14,7 @@ [System.ServiceModel.ServiceContractAttribute(Namespace="http://microsoft.wcf.documentation", ConfigurationName="SampleDuplexHello", CallbackContract=typeof(SampleDuplexHelloCallback), SessionMode=System.ServiceModel.SessionMode.Required)] public interface SampleDuplexHello { - + [System.ServiceModel.OperationContractAttribute(IsOneWay=true, Action="http://microsoft.wcf.documentation/SampleDuplexHello/Hello")] void Hello(string greeting); } @@ -22,7 +22,7 @@ public interface SampleDuplexHello [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")] public interface SampleDuplexHelloCallback { - + [System.ServiceModel.OperationContractAttribute(IsOneWay=true, Action="http://microsoft.wcf.documentation/SampleDuplexHello/Reply")] void Reply(string responseToGreeting); } @@ -36,32 +36,32 @@ public interface SampleDuplexHelloChannel : SampleDuplexHello, System.ServiceMod [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")] public partial class SampleDuplexHelloClient : System.ServiceModel.DuplexClientBase, SampleDuplexHello { - - public SampleDuplexHelloClient(System.ServiceModel.InstanceContext callbackInstance) : + + public SampleDuplexHelloClient(System.ServiceModel.InstanceContext callbackInstance) : base(callbackInstance) { } - - public SampleDuplexHelloClient(System.ServiceModel.InstanceContext callbackInstance, string endpointConfigurationName) : + + public SampleDuplexHelloClient(System.ServiceModel.InstanceContext callbackInstance, string endpointConfigurationName) : base(callbackInstance, endpointConfigurationName) { } - - public SampleDuplexHelloClient(System.ServiceModel.InstanceContext callbackInstance, string endpointConfigurationName, string remoteAddress) : + + public SampleDuplexHelloClient(System.ServiceModel.InstanceContext callbackInstance, string endpointConfigurationName, string remoteAddress) : base(callbackInstance, endpointConfigurationName, remoteAddress) { } - - public SampleDuplexHelloClient(System.ServiceModel.InstanceContext callbackInstance, string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : + + public SampleDuplexHelloClient(System.ServiceModel.InstanceContext callbackInstance, string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : base(callbackInstance, endpointConfigurationName, remoteAddress) { } - - public SampleDuplexHelloClient(System.ServiceModel.InstanceContext callbackInstance, System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : + + public SampleDuplexHelloClient(System.ServiceModel.InstanceContext callbackInstance, System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : base(callbackInstance, binding, remoteAddress) { } - + public void Hello(string greeting) { base.Channel.Hello(greeting); diff --git a/samples/snippets/csharp/VS_Snippets_CFX/cdf_wcf_securityconsiderationsfordata/cs/program.cs b/samples/snippets/csharp/VS_Snippets_CFX/cdf_wcf_securityconsiderationsfordata/cs/program.cs index b24eec3b57250..29b75ddccfa0b 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/cdf_wcf_securityconsiderationsfordata/cs/program.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/cdf_wcf_securityconsiderationsfordata/cs/program.cs @@ -16,7 +16,7 @@ public static void Main(string[] args) { try { -// PermissionsHelper.InternetZone corresponds to the PermissionSet for partial trust. +// PermissionsHelper.InternetZone corresponds to the PermissionSet for partial trust. // PermissionsHelper.InternetZone.PermitOnly(); MemoryStream memoryStream = new MemoryStream(); new DataContractSerializer(typeof(DataNode)). diff --git a/samples/snippets/csharp/VS_Snippets_CFX/cfx_wf_gettingstarted/cs/extrasnippets.cs b/samples/snippets/csharp/VS_Snippets_CFX/cfx_wf_gettingstarted/cs/extrasnippets.cs index 2bf23a2a318e8..310adbf4bf0da 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/cfx_wf_gettingstarted/cs/extrasnippets.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/cfx_wf_gettingstarted/cs/extrasnippets.cs @@ -20,7 +20,7 @@ void Snippet2() void Snippet4() { - + // AutoResetEvent syncEvent = new AutoResetEvent(false); diff --git a/samples/snippets/csharp/VS_Snippets_CFX/cfx_wf_gettingstarted/cs/readint.cs b/samples/snippets/csharp/VS_Snippets_CFX/cfx_wf_gettingstarted/cs/readint.cs index 85c17e10550e5..ee183bcd9eb2c 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/cfx_wf_gettingstarted/cs/readint.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/cfx_wf_gettingstarted/cs/readint.cs @@ -25,8 +25,8 @@ protected override void Execute(NativeActivityContext context) context.CreateBookmark(name, new BookmarkCallback(OnReadComplete)); } - // NativeActivity derived activities that do asynchronous operations by calling - // one of the CreateBookmark overloads defined on System.Activities.NativeActivityContext + // NativeActivity derived activities that do asynchronous operations by calling + // one of the CreateBookmark overloads defined on System.Activities.NativeActivityContext // must override the CanInduceIdle property and return true. protected override bool CanInduceIdle { diff --git a/samples/snippets/csharp/VS_Snippets_CFX/cfx_workflowapplicationexample/cs/program.cs b/samples/snippets/csharp/VS_Snippets_CFX/cfx_workflowapplicationexample/cs/program.cs index a41f5efae2733..09f686254a700 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/cfx_workflowapplicationexample/cs/program.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/cfx_workflowapplicationexample/cs/program.cs @@ -148,16 +148,16 @@ private static void RunWorkflow(Activity wf) wfApp.OnUnhandledException = delegate(WorkflowApplicationUnhandledExceptionEventArgs e) { // Display the unhandled exception. - Console.WriteLine("OnUnhandledException in Workflow {0}: {1}", + Console.WriteLine("OnUnhandledException in Workflow {0}: {1}", e.InstanceId, e.UnhandledException.Message); - Console.WriteLine("ExceptionSource: {0} - {1}", + Console.WriteLine("ExceptionSource: {0} - {1}", e.ExceptionSource, e.ExceptionSourceInstanceId); // Instruct the runtime to terminate the workflow. return UnhandledExceptionAction.Terminate; - // Other choices are UnhandledExceptionAction.Abort and + // Other choices are UnhandledExceptionAction.Abort and // UnhandledExceptionAction.Cancel }; @@ -198,7 +198,7 @@ static void snippet1() }, new Throw { - Exception = new InArgument((env) => + Exception = new InArgument((env) => new ApplicationException("Something unexpected happened.")) }, new WriteLine @@ -222,7 +222,7 @@ static void snippet1() // Instruct the runtime to terminate the workflow. return UnhandledExceptionAction.Terminate; - // Other choices are UnhandledExceptionAction.Abort and + // Other choices are UnhandledExceptionAction.Abort and // UnhandledExceptionAction.Cancel }; @@ -322,7 +322,7 @@ static void snippet5() }, new Throw { - Exception = new InArgument((env) => + Exception = new InArgument((env) => new ApplicationException("Something unexpected happened.")) }, new WriteLine @@ -411,7 +411,7 @@ static void snippet6() }, new Throw { - Exception = new InArgument((env) => + Exception = new InArgument((env) => new ApplicationException("Something unexpected happened.")) }, new WriteLine @@ -492,7 +492,7 @@ static void snippet7() }, new Throw { - Exception = new InArgument((env) => + Exception = new InArgument((env) => new ApplicationException("Something unexpected happened.")) }, new WriteLine @@ -567,7 +567,7 @@ static void snippet8() }, new Throw { - Exception = new InArgument((env) => + Exception = new InArgument((env) => new ApplicationException("Something unexpected happened.")) }, new WriteLine @@ -688,7 +688,7 @@ static void snippet9() e.Reason.GetType().FullName, e.Reason.Message); }; - + wfApp.Idle = delegate(WorkflowApplicationIdleEventArgs e) { // Perform any processing that should occur @@ -1037,7 +1037,7 @@ static void snippet35() { Body = new Sequence { - Activities = + Activities = { new WriteLine { @@ -1098,7 +1098,7 @@ static void snippet36() { Body = new Sequence { - Activities = + Activities = { new WriteLine { @@ -1106,7 +1106,7 @@ static void snippet36() }, new Throw { - Exception = new InArgument((env) => + Exception = new InArgument((env) => new ApplicationException("An ApplicationException was thrown.")) }, new WriteLine @@ -1166,13 +1166,13 @@ static void snippet37() Activity wf = new Parallel { CompletionCondition = true, - Branches = + Branches = { new CancellationScope { Body = new Sequence { - Activities = + Activities = { new WriteLine { @@ -1236,13 +1236,13 @@ static void snippet38() Try = new Parallel { CompletionCondition = true, - Branches = + Branches = { new CancellationScope { Body = new Sequence { - Activities = + Activities = { new WriteLine { @@ -1250,7 +1250,7 @@ static void snippet38() }, new Throw { - Exception = new InArgument((env) => + Exception = new InArgument((env) => new ApplicationException("An ApplicationException was thrown.")) }, new WriteLine @@ -1322,7 +1322,7 @@ static void snippet39() { Body = new Sequence { - Activities = + Activities = { new WriteLine { @@ -1330,7 +1330,7 @@ static void snippet39() }, new Throw { - Exception = new InArgument((env) => + Exception = new InArgument((env) => new ApplicationException("An ApplicationException was thrown.")) }, new WriteLine @@ -1394,7 +1394,7 @@ static void snippet40() { Body = new Sequence { - Activities = + Activities = { new WriteLine { @@ -1402,7 +1402,7 @@ static void snippet40() }, new Throw { - Exception = new InArgument((env) => + Exception = new InArgument((env) => new ApplicationException("An ApplicationException was thrown.")) }, new WriteLine @@ -1466,7 +1466,7 @@ static void snippet41() ab.Properties.Add(new DynamicActivityProperty { Name = "Operand2", Type = typeof(InArgument) }); ab.Implementation = new Sequence { - Activities = + Activities = { new WriteLine { @@ -1537,8 +1537,8 @@ static void snippet41() PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(wf); foreach (PropertyDescriptor property in properties) { - if (property.PropertyType.IsGenericType && - (property.PropertyType.GetGenericTypeDefinition() == typeof(InArgument<>) || + if (property.PropertyType.IsGenericType && + (property.PropertyType.GetGenericTypeDefinition() == typeof(InArgument<>) || property.PropertyType.GetGenericTypeDefinition() == typeof(InOutArgument<>))) { Type targetType = property.PropertyType.GetGenericArguments()[0]; @@ -1585,7 +1585,7 @@ private static Activity ActivityTreeInspection() }, new Sequence { - Activities = + Activities = { new WriteLine { @@ -1608,7 +1608,7 @@ private static Activity ActivityTreeInspection() static void InspectActivity(Activity root, int indent) { // Inspect the activity tree using WorkflowInspectionServices. - IEnumerator activities = + IEnumerator activities = WorkflowInspectionServices.GetActivities(root).GetEnumerator(); Console.WriteLine("{0}{1}", new string(' ', indent), root.DisplayName); @@ -1660,7 +1660,7 @@ static void snippet57() }, new Sequence { - Activities = + Activities = { new WriteLine { @@ -1733,7 +1733,7 @@ static void snippet59() }, new Sequence { - Activities = + Activities = { new WriteLine { @@ -1886,7 +1886,7 @@ static void snippet51() { TargetObject = new InArgument(new VisualBasicValue("New Random()")), MethodName = "Next", - Parameters = + Parameters = { new InArgument(1), new InArgument(101) @@ -1954,7 +1954,7 @@ static void snippet55() Implementation = () => new Sequence { - Activities = + Activities = { new Assign { @@ -1998,7 +1998,7 @@ static void snippet14() }, new WriteLine { - Text = new InArgument((env) => + Text = new InArgument((env) => ("Hello, " + name.Get(env))) } } @@ -2393,7 +2393,7 @@ static void snippet22() }, new WriteLine { - Text = new InArgument((env) => + Text = new InArgument((env) => ("Hello, " + name.Get(env))) } } @@ -2422,7 +2422,7 @@ static void snippet22() // is idle. If a call to ResumeBookmark is made and the workflow // is not idle, ResumeBookmark blocks until the workflow becomes // idle before resuming the bookmark. - BookmarkResumptionResult result = wfApp.ResumeBookmark("UserName", + BookmarkResumptionResult result = wfApp.ResumeBookmark("UserName", Console.ReadLine()); // Possible BookmarkResumptionResult values: @@ -2453,7 +2453,7 @@ static void snippet23() }, new WriteLine { - Text = new InArgument((env) => + Text = new InArgument((env) => ("Hello, " + name.Get(env))) } } @@ -2478,7 +2478,7 @@ static void snippet23() idleEvent.WaitOne(); // Gather the user's input and resume the bookmark. - BookmarkResumptionResult result = wfApp.ResumeBookmark("UserName", + BookmarkResumptionResult result = wfApp.ResumeBookmark("UserName", Console.ReadLine(), TimeSpan.FromSeconds(15)); // Possible BookmarkResumptionResult values: @@ -2508,7 +2508,7 @@ static void snippet24() }, new WriteLine { - Text = new InArgument((env) => + Text = new InArgument((env) => ("Hello, " + name.Get(env))) } } @@ -2533,7 +2533,7 @@ static void snippet24() idleEvent.WaitOne(); // Gather the user's input and resume the bookmark. - BookmarkResumptionResult result = wfApp.ResumeBookmark(new Bookmark("UserName"), + BookmarkResumptionResult result = wfApp.ResumeBookmark(new Bookmark("UserName"), Console.ReadLine()); // Possible BookmarkResumptionResult values: @@ -2564,7 +2564,7 @@ static void snippet25() }, new WriteLine { - Text = new InArgument((env) => + Text = new InArgument((env) => ("Hello, " + name.Get(env))) } } @@ -2589,7 +2589,7 @@ static void snippet25() idleEvent.WaitOne(); // Gather the user's input and resume the bookmark. - BookmarkResumptionResult result = wfApp.ResumeBookmark(new Bookmark("UserName"), + BookmarkResumptionResult result = wfApp.ResumeBookmark(new Bookmark("UserName"), Console.ReadLine(), TimeSpan.FromSeconds(15)); // Possible BookmarkResumptionResult values: @@ -2649,7 +2649,7 @@ static void StartAndUnloadInstance() application.InstanceStore = instanceStore; - //returning IdleAction.Unload instructs the WorkflowApplication to persists application state and remove it from memory + //returning IdleAction.Unload instructs the WorkflowApplication to persists application state and remove it from memory application.PersistableIdle = (e) => { return PersistableIdleAction.Unload; @@ -2660,7 +2660,7 @@ static void StartAndUnloadInstance() instanceUnloaded.Set(); }; - //This call is not required + //This call is not required //Calling persist here captures the application durably before it has been started application.Persist(); id = application.Id; @@ -2880,7 +2880,7 @@ static void snippet33() { Exception = new InArgument((env) =>new ApplicationException("An ApplicationException was thrown.")) }, - Catches = + Catches = { new Catch { @@ -2999,8 +2999,8 @@ protected override void Execute(NativeActivityContext context) context.CreateBookmark(name, new BookmarkCallback(OnReadComplete)); } - // NativeActivity derived activities that do asynchronous operations by calling - // one of the CreateBookmark overloads defined on System.Activities.NativeActivityContext + // NativeActivity derived activities that do asynchronous operations by calling + // one of the CreateBookmark overloads defined on System.Activities.NativeActivityContext // must override the CanInduceIdle property and return true. protected override bool CanInduceIdle { @@ -3029,8 +3029,8 @@ protected override void Execute(NativeActivityContext context) new BookmarkCallback(OnResumeBookmark)); } - // NativeActivity derived activities that do asynchronous operations by calling - // one of the CreateBookmark overloads defined on System.Activities.NativeActivityContext + // NativeActivity derived activities that do asynchronous operations by calling + // one of the CreateBookmark overloads defined on System.Activities.NativeActivityContext // must override the CanInduceIdle property and return true. protected override bool CanInduceIdle { @@ -3205,7 +3205,7 @@ private void DisposePipeline(Pipeline pipeline) { throw new NotImplementedException(); } - + protected override IAsyncResult BeginExecute(AsyncCodeActivityContext context, AsyncCallback callback, object state) { throw new NotImplementedException(); diff --git a/samples/snippets/csharp/VS_Snippets_CFX/cfx_workflowinvokerexample/cs/program.cs b/samples/snippets/csharp/VS_Snippets_CFX/cfx_workflowinvokerexample/cs/program.cs index 18fce2834d303..f04bf69d3f781 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/cfx_workflowinvokerexample/cs/program.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/cfx_workflowinvokerexample/cs/program.cs @@ -326,7 +326,7 @@ static void Snippet50() // Activity wf = new Sequence() { - Activities = + Activities = { new WriteLine() { @@ -364,7 +364,7 @@ static void Snippet51() // Activity wf = new Sequence() { - Activities = + Activities = { new WriteLine() { diff --git a/samples/snippets/csharp/VS_Snippets_CFX/channelfactorybehaviors/cs/client.cs b/samples/snippets/csharp/VS_Snippets_CFX/channelfactorybehaviors/cs/client.cs index acc1c3d63ec7e..fc89435565145 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/channelfactorybehaviors/cs/client.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/channelfactorybehaviors/cs/client.cs @@ -5,7 +5,7 @@ using microsoft.wcf.documentation; // for the client behavior using Microsoft.WCF.Documentation; - + // public class Client { @@ -14,7 +14,7 @@ public static void Main() try { // Picks up configuration from the config file. - ChannelFactory factory + ChannelFactory factory = new ChannelFactory("WSHttpBinding_ISampleService"); // Add the client side behavior programmatically to all created channels. @@ -30,7 +30,7 @@ ChannelFactory factory Console.WriteLine("Press ENTER to exit:"); Console.ReadLine(); - // Done with service. + // Done with service. wcfClientChannel.Close(); Console.WriteLine("Done!"); } diff --git a/samples/snippets/csharp/VS_Snippets_CFX/channelfactorybehaviors/cs/proxycode.cs b/samples/snippets/csharp/VS_Snippets_CFX/channelfactorybehaviors/cs/proxycode.cs index e56a57b82264c..5cdae074f6d9d 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/channelfactorybehaviors/cs/proxycode.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/channelfactorybehaviors/cs/proxycode.cs @@ -13,17 +13,17 @@ namespace microsoft.wcf.documentation { using System.Runtime.Serialization; - - + + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "3.0.0.0")] [System.Runtime.Serialization.DataContractAttribute()] public partial class SampleFault : object, System.Runtime.Serialization.IExtensibleDataObject { - + private System.Runtime.Serialization.ExtensionDataObject extensionDataField; - + private string FaultMessageField; - + public System.Runtime.Serialization.ExtensionDataObject ExtensionData { get @@ -35,7 +35,7 @@ public System.Runtime.Serialization.ExtensionDataObject ExtensionData this.extensionDataField = value; } } - + [System.Runtime.Serialization.DataMemberAttribute()] public string FaultMessage { @@ -56,7 +56,7 @@ public string FaultMessage [System.ServiceModel.ServiceContractAttribute(Namespace="http://microsoft.wcf.documentation")] public interface ISampleService { - + [System.ServiceModel.OperationContractAttribute(Action="http://microsoft.wcf.documentation/ISampleService/SampleMethod", ReplyAction="http://microsoft.wcf.documentation/ISampleService/SampleMethodResponse")] [System.ServiceModel.FaultContractAttribute(typeof(microsoft.wcf.documentation.SampleFault), Action="http://microsoft.wcf.documentation/ISampleService/SampleMethodSampleFaultFault")] string SampleMethod(string msg); @@ -70,31 +70,31 @@ public interface ISampleServiceChannel : ISampleService, System.ServiceModel.ICl [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")] public partial class SampleServiceClient : System.ServiceModel.ClientBase, ISampleService { - + public SampleServiceClient() { } - - public SampleServiceClient(string endpointConfigurationName) : + + public SampleServiceClient(string endpointConfigurationName) : base(endpointConfigurationName) { } - - public SampleServiceClient(string endpointConfigurationName, string remoteAddress) : + + public SampleServiceClient(string endpointConfigurationName, string remoteAddress) : base(endpointConfigurationName, remoteAddress) { } - - public SampleServiceClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : + + public SampleServiceClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : base(endpointConfigurationName, remoteAddress) { } - - public SampleServiceClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : + + public SampleServiceClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : base(binding, remoteAddress) { } - + public string SampleMethod(string msg) { return base.Channel.SampleMethod(msg); diff --git a/samples/snippets/csharp/VS_Snippets_CFX/channelprogrammingbasic/cs/serviceprogram.cs b/samples/snippets/csharp/VS_Snippets_CFX/channelprogrammingbasic/cs/serviceprogram.cs index b7d784fa1834c..919ca0866e34b 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/channelprogrammingbasic/cs/serviceprogram.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/channelprogrammingbasic/cs/serviceprogram.cs @@ -14,7 +14,7 @@ static void RunService() CustomBinding binding = new CustomBinding(bindingElements); - //Step2: Use the binding to build the channel listener. + //Step2: Use the binding to build the channel listener. IChannelListener listener = binding.BuildChannelListener( new Uri("http://localhost:8080/channelapp"), @@ -40,8 +40,8 @@ static void RunService() Console.WriteLine("Message content: {0}",data); //Send a reply. Message replymessage=Message.CreateMessage( - binding.MessageVersion, - "http://contoso.com/someotheraction", + binding.MessageVersion, + "http://contoso.com/someotheraction", data); request.Reply(replymessage); //Step5: Closing objects. diff --git a/samples/snippets/csharp/VS_Snippets_CFX/clientproxycodesample/cs/client.cs b/samples/snippets/csharp/VS_Snippets_CFX/clientproxycodesample/cs/client.cs index 647b2f6d0fbbb..253917eb7c074 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/clientproxycodesample/cs/client.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/clientproxycodesample/cs/client.cs @@ -3,7 +3,7 @@ using System.ServiceModel.Channels; using microsoft.wcf.documentation; - + public class Client { public static void Main() @@ -21,7 +21,7 @@ public static void Main() Console.WriteLine("Press ENTER to exit:"); Console.ReadLine(); - // Done with service. + // Done with service. wcfClient.Close(); Console.WriteLine("Done!"); } diff --git a/samples/snippets/csharp/VS_Snippets_CFX/clientproxycodesample/cs/proxycode.cs b/samples/snippets/csharp/VS_Snippets_CFX/clientproxycodesample/cs/proxycode.cs index b0451f051efea..01933e19c56fa 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/clientproxycodesample/cs/proxycode.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/clientproxycodesample/cs/proxycode.cs @@ -14,16 +14,16 @@ namespace microsoft.wcf.documentation { using System.Runtime.Serialization; - + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "3.0.0.0")] [System.Runtime.Serialization.DataContractAttribute()] public partial class SampleFault : object, System.Runtime.Serialization.IExtensibleDataObject { - + private System.Runtime.Serialization.ExtensionDataObject extensionDataField; - + private string FaultMessageField; - + public System.Runtime.Serialization.ExtensionDataObject ExtensionData { get @@ -35,7 +35,7 @@ public System.Runtime.Serialization.ExtensionDataObject ExtensionData this.extensionDataField = value; } } - + [System.Runtime.Serialization.DataMemberAttribute()] public string FaultMessage { @@ -59,13 +59,13 @@ public string FaultMessage )] public interface ISampleService { - + [System.ServiceModel.OperationContractAttribute( - Action="http://microsoft.wcf.documentation/ISampleService/SampleMethod", + Action="http://microsoft.wcf.documentation/ISampleService/SampleMethod", ReplyAction="http://microsoft.wcf.documentation/ISampleService/SampleMethodResponse" )] [System.ServiceModel.FaultContractAttribute( - typeof(microsoft.wcf.documentation.SampleFault), + typeof(microsoft.wcf.documentation.SampleFault), Action="http://microsoft.wcf.documentation/ISampleService/SampleMethodSampleFaultFault" )] string SampleMethod(string msg); @@ -83,31 +83,31 @@ public interface ISampleServiceChannel : ISampleService, System.ServiceModel.ICl [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")] public partial class SampleServiceClient : System.ServiceModel.ClientBase, ISampleService { - + public SampleServiceClient() { } - - public SampleServiceClient(string endpointConfigurationName) : + + public SampleServiceClient(string endpointConfigurationName) : base(endpointConfigurationName) { } - - public SampleServiceClient(string endpointConfigurationName, string remoteAddress) : + + public SampleServiceClient(string endpointConfigurationName, string remoteAddress) : base(endpointConfigurationName, remoteAddress) { } - - public SampleServiceClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : + + public SampleServiceClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : base(endpointConfigurationName, remoteAddress) { } - - public SampleServiceClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : + + public SampleServiceClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : base(binding, remoteAddress) { } - + public string SampleMethod(string msg) { return base.Channel.SampleMethod(msg); diff --git a/samples/snippets/csharp/VS_Snippets_CFX/custompolicysample/cs/client.cs b/samples/snippets/csharp/VS_Snippets_CFX/custompolicysample/cs/client.cs index 3d5cdfec545ad..482c4c184f0a2 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/custompolicysample/cs/client.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/custompolicysample/cs/client.cs @@ -21,7 +21,7 @@ void Run() try { // - // Download all metadata. + // Download all metadata. ServiceEndpointCollection endpoints = MetadataResolver.Resolve( typeof(IStatefulService), diff --git a/samples/snippets/csharp/VS_Snippets_CFX/custompolicysample/cs/policyexporter.cs b/samples/snippets/csharp/VS_Snippets_CFX/custompolicysample/cs/policyexporter.cs index 9653a5170cee7..9a7b59f04e9c0 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/custompolicysample/cs/policyexporter.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/custompolicysample/cs/policyexporter.cs @@ -32,7 +32,7 @@ public void ExportPolicy(MetadataExporter exporter, PolicyConversionContext poli throw new NullReferenceException("The MetadataExporter object passed to the ExporterBindingElement is null."); if (policyContext == null) throw new NullReferenceException("The PolicyConversionContext object passed to the ExporterBindingElement is null."); - + XmlElement elem = doc.CreateElement(name1, ns1); elem.InnerText = "My custom text."; XmlAttribute att = doc.CreateAttribute("MyCustomAttribute", ns1); @@ -49,8 +49,8 @@ public void ExportPolicy(MetadataExporter exporter, PolicyConversionContext poli public override BindingElement Clone() { - // Note: All custom binding elements must return a deep clone - // to enable the run time to support multiple bindings using the + // Note: All custom binding elements must return a deep clone + // to enable the run time to support multiple bindings using the // same custom binding. return this; } diff --git a/samples/snippets/csharp/VS_Snippets_CFX/custompolicysample/cs/policyimporter.cs b/samples/snippets/csharp/VS_Snippets_CFX/custompolicysample/cs/policyimporter.cs index bc494154a415d..52f8fcd39e95a 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/custompolicysample/cs/policyimporter.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/custompolicysample/cs/policyimporter.cs @@ -22,8 +22,8 @@ public class CustomPolicyImporter : IPolicyImportExtension * 1. Find the custom assertion to import. * 2. Insert a supporting custom bindingelement or modify the current binding element collection * to support the assertion. - * 3. Remove the assertion from the collection. Once the ImportPolicy method has returned, - * any remaining assertions for the binding cause the binding to fail import and not be + * 3. Remove the assertion from the collection. Once the ImportPolicy method has returned, + * any remaining assertions for the binding cause the binding to fail import and not be * constructed. */ public void ImportPolicy(MetadataImporter importer, PolicyConversionContext context) diff --git a/samples/snippets/csharp/VS_Snippets_CFX/custompolicysample/cs/proxycode.cs b/samples/snippets/csharp/VS_Snippets_CFX/custompolicysample/cs/proxycode.cs index 98ddc30596013..91f2091392add 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/custompolicysample/cs/proxycode.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/custompolicysample/cs/proxycode.cs @@ -14,7 +14,7 @@ [System.ServiceModel.ServiceContractAttribute(Namespace="http://microsoft.wcf.documentation", ConfigurationName="IStatefulService", SessionMode=System.ServiceModel.SessionMode.Required)] public interface IStatefulService { - + [System.ServiceModel.OperationContractAttribute(Action="http://microsoft.wcf.documentation/IStatefulService/GetSessionID", ReplyAction="http://microsoft.wcf.documentation/IStatefulService/GetSessionIDResponse")] string GetSessionID(); } @@ -28,31 +28,31 @@ public interface IStatefulServiceChannel : IStatefulService, System.ServiceModel [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")] public partial class StatefulServiceClient : System.ServiceModel.ClientBase, IStatefulService { - + public StatefulServiceClient() { } - - public StatefulServiceClient(string endpointConfigurationName) : + + public StatefulServiceClient(string endpointConfigurationName) : base(endpointConfigurationName) { } - - public StatefulServiceClient(string endpointConfigurationName, string remoteAddress) : + + public StatefulServiceClient(string endpointConfigurationName, string remoteAddress) : base(endpointConfigurationName, remoteAddress) { } - - public StatefulServiceClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : + + public StatefulServiceClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : base(endpointConfigurationName, remoteAddress) { } - - public StatefulServiceClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : + + public StatefulServiceClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : base(binding, remoteAddress) { } - + public string GetSessionID() { return base.Channel.GetSessionID(); diff --git a/samples/snippets/csharp/VS_Snippets_CFX/custompolicysample/cs/services.cs b/samples/snippets/csharp/VS_Snippets_CFX/custompolicysample/cs/services.cs index 03a2cfaa787c6..b8504392b6030 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/custompolicysample/cs/services.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/custompolicysample/cs/services.cs @@ -6,13 +6,13 @@ namespace Microsoft.WCF.Documentation { [ServiceContract( - Namespace="http://microsoft.wcf.documentation", + Namespace="http://microsoft.wcf.documentation", SessionMode=SessionMode.Required )] public interface IStatefulService { [OperationContract] - string GetSessionID(); + string GetSessionID(); } [ServiceBehavior( diff --git a/samples/snippets/csharp/VS_Snippets_CFX/datacontractattribute/cs/overview.cs b/samples/snippets/csharp/VS_Snippets_CFX/datacontractattribute/cs/overview.cs index 169be479cf8b5..4d4a8c85ccd3d 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/datacontractattribute/cs/overview.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/datacontractattribute/cs/overview.cs @@ -63,7 +63,7 @@ public static void Main() public static void WriteObject(string path) { - // Create a new instance of the Person class and + // Create a new instance of the Person class and // serialize it to an XML file. Person p1 = new Person("Mary", 1); // Create a new instance of a StreamWriter @@ -80,8 +80,8 @@ public static void WriteObject(string path) } public static void ReadObject(string path) { - // Deserialize an instance of the Person class - // from an XML file. First create an instance of the + // Deserialize an instance of the Person class + // from an XML file. First create an instance of the // XmlDictionaryReader. FileStream fs = new FileStream(path, FileMode.OpenOrCreate); XmlDictionaryReader reader = @@ -118,7 +118,7 @@ public class Person [DataMember] private int Age; - // This is not serialized because the DataMemberAttribute + // This is not serialized because the DataMemberAttribute // has not been applied. private string MailingAddress; @@ -205,7 +205,7 @@ public void TestClass() xe.InnerText = "myContents"; xe.SetAttribute ("myAttribute","myValue"); - + XmlAttribute atr = xe.Attributes[0]; XmlComment cmnt = xd.CreateComment("myComment"); diff --git a/samples/snippets/csharp/VS_Snippets_CFX/datamemberattribute/cs/overview.cs b/samples/snippets/csharp/VS_Snippets_CFX/datamemberattribute/cs/overview.cs index 1c522dde484e9..c81e40256c21f 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/datamemberattribute/cs/overview.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/datamemberattribute/cs/overview.cs @@ -11,7 +11,7 @@ class Person : IExtensibleDataObject { private string LastNameValue; - // Apply the DataMemberAttribute to fields (or properties) + // Apply the DataMemberAttribute to fields (or properties) // that must be serialized. [DataMember()] public string FirstName; @@ -26,7 +26,7 @@ public string LastName [DataMember(Name = "ID")] public int IdNumber; - // Note that you can apply the DataMemberAttribute to + // Note that you can apply the DataMemberAttribute to // a private field as well. [DataMember] private string Secret; @@ -39,9 +39,9 @@ public Person(string newfName, string newLName, int newIdNumber) Secret = newfName + newLName + newIdNumber; } - // The extensionDataValue field holds data from future versions - // of the type. This enables this type to be compatible with - // future versions. The field is required to implement the + // The extensionDataValue field holds data from future versions + // of the type. This enables this type to be compatible with + // future versions. The field is required to implement the // IExtensibleDataObject interface. private ExtensionDataObject extensionDatavalue; @@ -98,7 +98,7 @@ public static void WriteObject(string filename) // public static void ReadObject(string filename) { - // Deserialize an instance of the Person class + // Deserialize an instance of the Person class // from an XML file. FileStream fs = new FileStream(filename, FileMode.OpenOrCreate); @@ -138,7 +138,7 @@ public class Employee [DataMember(EmitDefaultValue = false)] public int? bonus = null; - // This will be written as 57800 + // This will be written as 57800 [DataMember(EmitDefaultValue = false)] public int targetSalary = 57800; } diff --git a/samples/snippets/csharp/VS_Snippets_CFX/eventasync/cs/asyncresult.cs b/samples/snippets/csharp/VS_Snippets_CFX/eventasync/cs/asyncresult.cs index 8cda770be9439..bbaef7792676f 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/eventasync/cs/asyncresult.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/eventasync/cs/asyncresult.cs @@ -132,7 +132,7 @@ protected static TAsyncResult End(IAsyncResult result) { throw new ArgumentNullException("result"); } - + TAsyncResult asyncResult = result as TAsyncResult; if (asyncResult == null) diff --git a/samples/snippets/csharp/VS_Snippets_CFX/eventasync/cs/generatedclient.cs b/samples/snippets/csharp/VS_Snippets_CFX/eventasync/cs/generatedclient.cs index d4f44ceedf7c5..ef702a514405d 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/eventasync/cs/generatedclient.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/eventasync/cs/generatedclient.cs @@ -12,46 +12,46 @@ namespace Microsoft.ServiceModel.Samples { - - + + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")] [System.ServiceModel.ServiceContractAttribute(Namespace="http://Microsoft.ServiceModel.Samples", ConfigurationName="Microsoft.ServiceModel.Samples.ICalculator")] public interface ICalculator { - + [System.ServiceModel.OperationContractAttribute(Action="http://Microsoft.ServiceModel.Samples/ICalculator/Add", ReplyAction="http://Microsoft.ServiceModel.Samples/ICalculator/AddResponse")] double Add(double n1, double n2); - + [System.ServiceModel.OperationContractAttribute(AsyncPattern=true, Action="http://Microsoft.ServiceModel.Samples/ICalculator/Add", ReplyAction="http://Microsoft.ServiceModel.Samples/ICalculator/AddResponse")] System.IAsyncResult BeginAdd(double n1, double n2, System.AsyncCallback callback, object asyncState); - + double EndAdd(System.IAsyncResult result); - + [System.ServiceModel.OperationContractAttribute(Action="http://Microsoft.ServiceModel.Samples/ICalculator/Subtract", ReplyAction="http://Microsoft.ServiceModel.Samples/ICalculator/SubtractResponse")] double Subtract(double n1, double n2); - + [System.ServiceModel.OperationContractAttribute(AsyncPattern=true, Action="http://Microsoft.ServiceModel.Samples/ICalculator/Subtract", ReplyAction="http://Microsoft.ServiceModel.Samples/ICalculator/SubtractResponse")] System.IAsyncResult BeginSubtract(double n1, double n2, System.AsyncCallback callback, object asyncState); - + double EndSubtract(System.IAsyncResult result); - + [System.ServiceModel.OperationContractAttribute(Action="http://Microsoft.ServiceModel.Samples/ICalculator/Multiply", ReplyAction="http://Microsoft.ServiceModel.Samples/ICalculator/MultiplyResponse")] double Multiply(double n1, double n2); - + [System.ServiceModel.OperationContractAttribute(AsyncPattern=true, Action="http://Microsoft.ServiceModel.Samples/ICalculator/Multiply", ReplyAction="http://Microsoft.ServiceModel.Samples/ICalculator/MultiplyResponse")] System.IAsyncResult BeginMultiply(double n1, double n2, System.AsyncCallback callback, object asyncState); - + double EndMultiply(System.IAsyncResult result); - + [System.ServiceModel.OperationContractAttribute(Action="http://Microsoft.ServiceModel.Samples/ICalculator/Divide", ReplyAction="http://Microsoft.ServiceModel.Samples/ICalculator/DivideResponse")] double Divide(double n1, double n2); - + [System.ServiceModel.OperationContractAttribute(AsyncPattern=true, Action="http://Microsoft.ServiceModel.Samples/ICalculator/Divide", ReplyAction="http://Microsoft.ServiceModel.Samples/ICalculator/DivideResponse")] System.IAsyncResult BeginDivide(double n1, double n2, System.AsyncCallback callback, object asyncState); - + double EndDivide(System.IAsyncResult result); } - + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")] public interface ICalculatorChannel : Microsoft.ServiceModel.Samples.ICalculator, System.ServiceModel.IClientChannel { @@ -62,11 +62,11 @@ public interface ICalculatorChannel : Microsoft.ServiceModel.Samples.ICalculator public partial class AddCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { private object[] results; - - public AddCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + + public AddCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : base(exception, cancelled, userState) { this.results = results; } - + public double Result { get { @@ -76,20 +76,20 @@ public double Result } } // - + [System.Diagnostics.DebuggerStepThroughAttribute()] [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")] public partial class SubtractCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { - + private object[] results; - - public SubtractCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + + public SubtractCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : base(exception, cancelled, userState) { this.results = results; } - + public double Result { get @@ -99,20 +99,20 @@ public double Result } } } - + [System.Diagnostics.DebuggerStepThroughAttribute()] [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")] public partial class MultiplyCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { - + private object[] results; - - public MultiplyCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + + public MultiplyCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : base(exception, cancelled, userState) { this.results = results; } - + public double Result { get @@ -122,20 +122,20 @@ public double Result } } } - + [System.Diagnostics.DebuggerStepThroughAttribute()] [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")] public partial class DivideCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { - + private object[] results; - - public DivideCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + + public DivideCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : base(exception, cancelled, userState) { this.results = results; } - + public double Result { get @@ -145,100 +145,100 @@ public double Result } } } - + [System.Diagnostics.DebuggerStepThroughAttribute()] [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")] public partial class CalculatorClient : System.ServiceModel.ClientBase, Microsoft.ServiceModel.Samples.ICalculator { - + private BeginOperationDelegate onBeginAddDelegate; - + private EndOperationDelegate onEndAddDelegate; - + private System.Threading.SendOrPostCallback onAddCompletedDelegate; - + private BeginOperationDelegate onBeginSubtractDelegate; - + private EndOperationDelegate onEndSubtractDelegate; - + private System.Threading.SendOrPostCallback onSubtractCompletedDelegate; - + private BeginOperationDelegate onBeginMultiplyDelegate; - + private EndOperationDelegate onEndMultiplyDelegate; - + private System.Threading.SendOrPostCallback onMultiplyCompletedDelegate; - + private BeginOperationDelegate onBeginDivideDelegate; - + private EndOperationDelegate onEndDivideDelegate; - + private System.Threading.SendOrPostCallback onDivideCompletedDelegate; - + public CalculatorClient() { } - - public CalculatorClient(string endpointConfigurationName) : + + public CalculatorClient(string endpointConfigurationName) : base(endpointConfigurationName) { } - - public CalculatorClient(string endpointConfigurationName, string remoteAddress) : + + public CalculatorClient(string endpointConfigurationName, string remoteAddress) : base(endpointConfigurationName, remoteAddress) { } - - public CalculatorClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : + + public CalculatorClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : base(endpointConfigurationName, remoteAddress) { } - - public CalculatorClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : + + public CalculatorClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : base(binding, remoteAddress) { } // public event System.EventHandler AddCompleted; // - + public event System.EventHandler SubtractCompleted; - + public event System.EventHandler MultiplyCompleted; - + public event System.EventHandler DivideCompleted; - + public double Add(double n1, double n2) { return base.Channel.Add(n1, n2); } - + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] public System.IAsyncResult BeginAdd(double n1, double n2, System.AsyncCallback callback, object asyncState) { return base.Channel.BeginAdd(n1, n2, callback, asyncState); } - + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] public double EndAdd(System.IAsyncResult result) { return base.Channel.EndAdd(result); } - + private System.IAsyncResult OnBeginAdd(object[] inValues, System.AsyncCallback callback, object asyncState) { double n1 = ((double)(inValues[0])); double n2 = ((double)(inValues[1])); return this.BeginAdd(n1, n2, callback, asyncState); } - + private object[] OnEndAdd(System.IAsyncResult result) { double retVal = this.EndAdd(result); return new object[] { retVal}; } - + private void OnAddCompleted(object state) { System.EventHandler handler = this.AddCompleted; @@ -248,13 +248,13 @@ private void OnAddCompleted(object state) handler(this, new AddCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState)); } } - + // public void AddAsync(double n1, double n2) { this.AddAsync(n1, n2, null); } - + public void AddAsync(double n1, double n2, object userState) { if ((this.onBeginAddDelegate == null)) @@ -274,38 +274,38 @@ public void AddAsync(double n1, double n2, object userState) n2}, this.onEndAddDelegate, this.onAddCompletedDelegate, userState); } // - + public double Subtract(double n1, double n2) { return base.Channel.Subtract(n1, n2); } - + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] public System.IAsyncResult BeginSubtract(double n1, double n2, System.AsyncCallback callback, object asyncState) { return base.Channel.BeginSubtract(n1, n2, callback, asyncState); } - + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] public double EndSubtract(System.IAsyncResult result) { return base.Channel.EndSubtract(result); } - + private System.IAsyncResult OnBeginSubtract(object[] inValues, System.AsyncCallback callback, object asyncState) { double n1 = ((double)(inValues[0])); double n2 = ((double)(inValues[1])); return this.BeginSubtract(n1, n2, callback, asyncState); } - + private object[] OnEndSubtract(System.IAsyncResult result) { double retVal = this.EndSubtract(result); return new object[] { retVal}; } - + private void OnSubtractCompleted(object state) { System.EventHandler handler = this.SubtractCompleted; @@ -315,12 +315,12 @@ private void OnSubtractCompleted(object state) handler(this, new SubtractCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState)); } } - + public void SubtractAsync(double n1, double n2) { this.SubtractAsync(n1, n2, null); } - + public void SubtractAsync(double n1, double n2, object userState) { if ((this.onBeginSubtractDelegate == null)) @@ -339,38 +339,38 @@ public void SubtractAsync(double n1, double n2, object userState) n1, n2}, this.onEndSubtractDelegate, this.onSubtractCompletedDelegate, userState); } - + public double Multiply(double n1, double n2) { return base.Channel.Multiply(n1, n2); } - + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] public System.IAsyncResult BeginMultiply(double n1, double n2, System.AsyncCallback callback, object asyncState) { return base.Channel.BeginMultiply(n1, n2, callback, asyncState); } - + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] public double EndMultiply(System.IAsyncResult result) { return base.Channel.EndMultiply(result); } - + private System.IAsyncResult OnBeginMultiply(object[] inValues, System.AsyncCallback callback, object asyncState) { double n1 = ((double)(inValues[0])); double n2 = ((double)(inValues[1])); return this.BeginMultiply(n1, n2, callback, asyncState); } - + private object[] OnEndMultiply(System.IAsyncResult result) { double retVal = this.EndMultiply(result); return new object[] { retVal}; } - + private void OnMultiplyCompleted(object state) { System.EventHandler handler = this.MultiplyCompleted; @@ -380,12 +380,12 @@ private void OnMultiplyCompleted(object state) handler(this, new MultiplyCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState)); } } - + public void MultiplyAsync(double n1, double n2) { this.MultiplyAsync(n1, n2, null); } - + public void MultiplyAsync(double n1, double n2, object userState) { if ((this.onBeginMultiplyDelegate == null)) @@ -404,38 +404,38 @@ public void MultiplyAsync(double n1, double n2, object userState) n1, n2}, this.onEndMultiplyDelegate, this.onMultiplyCompletedDelegate, userState); } - + public double Divide(double n1, double n2) { return base.Channel.Divide(n1, n2); } - + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] public System.IAsyncResult BeginDivide(double n1, double n2, System.AsyncCallback callback, object asyncState) { return base.Channel.BeginDivide(n1, n2, callback, asyncState); } - + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] public double EndDivide(System.IAsyncResult result) { return base.Channel.EndDivide(result); } - + private System.IAsyncResult OnBeginDivide(object[] inValues, System.AsyncCallback callback, object asyncState) { double n1 = ((double)(inValues[0])); double n2 = ((double)(inValues[1])); return this.BeginDivide(n1, n2, callback, asyncState); } - + private object[] OnEndDivide(System.IAsyncResult result) { double retVal = this.EndDivide(result); return new object[] { retVal}; } - + private void OnDivideCompleted(object state) { System.EventHandler handler = this.DivideCompleted; @@ -445,12 +445,12 @@ private void OnDivideCompleted(object state) handler(this, new DivideCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState)); } } - + public void DivideAsync(double n1, double n2) { this.DivideAsync(n1, n2, null); } - + public void DivideAsync(double n1, double n2, object userState) { if ((this.onBeginDivideDelegate == null)) diff --git a/samples/snippets/csharp/VS_Snippets_CFX/faultcontractattribute/cs/client.cs b/samples/snippets/csharp/VS_Snippets_CFX/faultcontractattribute/cs/client.cs index 70d38ff2bfb6f..812dfaaf77859 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/faultcontractattribute/cs/client.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/faultcontractattribute/cs/client.cs @@ -20,7 +20,7 @@ public static void Main() Console.WriteLine("Press ENTER to exit:"); Console.ReadLine(); - // Done with service. + // Done with service. wcfClient.Close(); Console.WriteLine("Done!"); } diff --git a/samples/snippets/csharp/VS_Snippets_CFX/faultcontractattribute/cs/proxycode.cs b/samples/snippets/csharp/VS_Snippets_CFX/faultcontractattribute/cs/proxycode.cs index 5f937333cf459..b6d76c84784be 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/faultcontractattribute/cs/proxycode.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/faultcontractattribute/cs/proxycode.cs @@ -11,17 +11,17 @@ namespace Microsoft.WCF.Documentation { using System.Runtime.Serialization; - - + + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "3.0.0.0")] [System.Runtime.Serialization.DataContractAttribute()] public partial class GreetingFault : object, System.Runtime.Serialization.IExtensibleDataObject { - + private System.Runtime.Serialization.ExtensionDataObject extensionDataField; - + private string MessageField; - + public System.Runtime.Serialization.ExtensionDataObject ExtensionData { get @@ -33,7 +33,7 @@ public System.Runtime.Serialization.ExtensionDataObject ExtensionData this.extensionDataField = value; } } - + [System.Runtime.Serialization.DataMemberAttribute()] public string Message { @@ -54,7 +54,7 @@ public string Message [System.ServiceModel.ServiceContractAttribute(Namespace="http://microsoft.wcf.documentation", ConfigurationName="ISampleService")] public interface ISampleService { - + [System.ServiceModel.OperationContractAttribute(Action="http://microsoft.wcf.documentation/ISampleService/SampleMethod", ReplyAction="http://microsoft.wcf.documentation/ISampleService/SampleMethodResponse")] [System.ServiceModel.FaultContractAttribute(typeof(Microsoft.WCF.Documentation.GreetingFault), Action="http://www.contoso.com/GreetingFault", Name="GreetingFault", Namespace="http://schemas.datacontract.org/2004/07/Microsoft.WCF.Documentation")] string SampleMethod(string msg); @@ -69,31 +69,31 @@ public interface ISampleServiceChannel : ISampleService, System.ServiceModel.ICl [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")] public partial class SampleServiceClient : System.ServiceModel.ClientBase, ISampleService { - + public SampleServiceClient() { } - - public SampleServiceClient(string endpointConfigurationName) : + + public SampleServiceClient(string endpointConfigurationName) : base(endpointConfigurationName) { } - - public SampleServiceClient(string endpointConfigurationName, string remoteAddress) : + + public SampleServiceClient(string endpointConfigurationName, string remoteAddress) : base(endpointConfigurationName, remoteAddress) { } - - public SampleServiceClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : + + public SampleServiceClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : base(endpointConfigurationName, remoteAddress) { } - - public SampleServiceClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : + + public SampleServiceClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : base(binding, remoteAddress) { } - + public string SampleMethod(string msg) { return base.Channel.SampleMethod(msg); diff --git a/samples/snippets/csharp/VS_Snippets_CFX/faultcontractattribute/cs/services.cs b/samples/snippets/csharp/VS_Snippets_CFX/faultcontractattribute/cs/services.cs index dfbb02ccee0eb..65cc032211229 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/faultcontractattribute/cs/services.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/faultcontractattribute/cs/services.cs @@ -20,10 +20,10 @@ public interface ISampleService{ string SampleMethod(string msg); // } - + [DataContractAttribute] public class GreetingFault - { + { private string report; public GreetingFault(string message) @@ -50,7 +50,7 @@ public string SampleMethod(string msg) Random rnd = new Random(DateTime.Now.Millisecond); int test = rnd.Next(5); if (test % 2 != 0) - return "The service greets you: " + msg; + return "The service greets you: " + msg; else // throw new FaultException(new GreetingFault("A Greeting error occurred. You said: " + msg)); diff --git a/samples/snippets/csharp/VS_Snippets_CFX/faults/cs/service.cs b/samples/snippets/csharp/VS_Snippets_CFX/faults/cs/service.cs index 91c894266d66b..1234e99226cb0 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/faults/cs/service.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/faults/cs/service.cs @@ -31,7 +31,7 @@ public interface ICalculator // Define a math fault data contract [DataContract(Namespace="http://Microsoft.ServiceModel.Samples")] public class MathFault - { + { private string operation; private string problemType; @@ -42,7 +42,7 @@ public string Operation set { operation = value; } } - [DataMember] + [DataMember] public string ProblemType { get { return problemType; } diff --git a/samples/snippets/csharp/VS_Snippets_CFX/htbasicservice/cs/service.cs b/samples/snippets/csharp/VS_Snippets_CFX/htbasicservice/cs/service.cs index 58af1c76611e8..307043c27448a 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/htbasicservice/cs/service.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/htbasicservice/cs/service.cs @@ -56,7 +56,7 @@ static void Main(string[] args) // cf.Endpoint.Behaviors.Add(new WebHttpBehavior()); // - + // IService channel = cf.CreateChannel(); @@ -82,7 +82,7 @@ static void Main(string[] args) Console.WriteLine("Press to terminate"); Console.ReadLine(); - + // host.Close(); // diff --git a/samples/snippets/csharp/VS_Snippets_CFX/htrssbasic/cs/snippets.cs b/samples/snippets/csharp/VS_Snippets_CFX/htrssbasic/cs/snippets.cs index 4700fbfb70591..3c9bbade0a3bc 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/htrssbasic/cs/snippets.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/htrssbasic/cs/snippets.cs @@ -24,7 +24,7 @@ public static void Snippet10() // XmlReader reader = XmlReader.Create("http://localhost:8000/BlogService/GetBlog"); SyndicationFeed feed = SyndicationFeed.Load(reader); - + // // Console.WriteLine(feed.Title.Text); diff --git a/samples/snippets/csharp/VS_Snippets_CFX/htsoapweb/cs/program.cs b/samples/snippets/csharp/VS_Snippets_CFX/htsoapweb/cs/program.cs index 3413c11c45709..e0708a1c5620b 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/htsoapweb/cs/program.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/htsoapweb/cs/program.cs @@ -50,10 +50,10 @@ static void Main(string[] args) ServiceEndpoint endpoint = host.AddServiceEndpoint(typeof(IService), new WebHttpBinding(), "Web"); endpoint.Behaviors.Add(new WebHttpBehavior()); // - + try { - // + // host.Open(); // diff --git a/samples/snippets/csharp/VS_Snippets_CFX/iinstancecontextinitializer/cs/channelinitializer.cs b/samples/snippets/csharp/VS_Snippets_CFX/iinstancecontextinitializer/cs/channelinitializer.cs index f241ecaef02d5..d15980eb24ea8 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/iinstancecontextinitializer/cs/channelinitializer.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/iinstancecontextinitializer/cs/channelinitializer.cs @@ -26,9 +26,9 @@ public class ChannelTrackerExtension : IExtension public ChannelTrackerExtension() { - this.instanceId = Guid.NewGuid().ToString(); + this.instanceId = Guid.NewGuid().ToString(); } - + public String InstanceId { get diff --git a/samples/snippets/csharp/VS_Snippets_CFX/iinstancecontextinitializer/cs/client.cs b/samples/snippets/csharp/VS_Snippets_CFX/iinstancecontextinitializer/cs/client.cs index 8d7a57e36cef8..d379ecac69495 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/iinstancecontextinitializer/cs/client.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/iinstancecontextinitializer/cs/client.cs @@ -3,7 +3,7 @@ using System.ServiceModel.Channels; using microsoft.wcf.documentation; - + public class Client { public static void Main() @@ -19,7 +19,7 @@ public static void Main() Console.WriteLine("The service responded: " + wcfClient.SampleMethod(greeting)); Console.WriteLine("The service responded: " + wcfClient.SampleMethod(greeting)); Console.WriteLine("The service responded: " + wcfClient.SampleMethod(greeting)); - // Done with service. + // Done with service. wcfClient.Close(); Console.WriteLine("Done!"); @@ -30,7 +30,7 @@ public static void Main() Console.WriteLine("Press ENTER to exit:"); Console.ReadLine(); - // Done with service. + // Done with service. newclient.Close(); ChannelFactory chFactory = new ChannelFactory("WSHttpBinding_ISampleService"); diff --git a/samples/snippets/csharp/VS_Snippets_CFX/iinstancecontextinitializer/cs/proxycode.cs b/samples/snippets/csharp/VS_Snippets_CFX/iinstancecontextinitializer/cs/proxycode.cs index e56a57b82264c..5cdae074f6d9d 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/iinstancecontextinitializer/cs/proxycode.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/iinstancecontextinitializer/cs/proxycode.cs @@ -13,17 +13,17 @@ namespace microsoft.wcf.documentation { using System.Runtime.Serialization; - - + + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "3.0.0.0")] [System.Runtime.Serialization.DataContractAttribute()] public partial class SampleFault : object, System.Runtime.Serialization.IExtensibleDataObject { - + private System.Runtime.Serialization.ExtensionDataObject extensionDataField; - + private string FaultMessageField; - + public System.Runtime.Serialization.ExtensionDataObject ExtensionData { get @@ -35,7 +35,7 @@ public System.Runtime.Serialization.ExtensionDataObject ExtensionData this.extensionDataField = value; } } - + [System.Runtime.Serialization.DataMemberAttribute()] public string FaultMessage { @@ -56,7 +56,7 @@ public string FaultMessage [System.ServiceModel.ServiceContractAttribute(Namespace="http://microsoft.wcf.documentation")] public interface ISampleService { - + [System.ServiceModel.OperationContractAttribute(Action="http://microsoft.wcf.documentation/ISampleService/SampleMethod", ReplyAction="http://microsoft.wcf.documentation/ISampleService/SampleMethodResponse")] [System.ServiceModel.FaultContractAttribute(typeof(microsoft.wcf.documentation.SampleFault), Action="http://microsoft.wcf.documentation/ISampleService/SampleMethodSampleFaultFault")] string SampleMethod(string msg); @@ -70,31 +70,31 @@ public interface ISampleServiceChannel : ISampleService, System.ServiceModel.ICl [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")] public partial class SampleServiceClient : System.ServiceModel.ClientBase, ISampleService { - + public SampleServiceClient() { } - - public SampleServiceClient(string endpointConfigurationName) : + + public SampleServiceClient(string endpointConfigurationName) : base(endpointConfigurationName) { } - - public SampleServiceClient(string endpointConfigurationName, string remoteAddress) : + + public SampleServiceClient(string endpointConfigurationName, string remoteAddress) : base(endpointConfigurationName, remoteAddress) { } - - public SampleServiceClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : + + public SampleServiceClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : base(endpointConfigurationName, remoteAddress) { } - - public SampleServiceClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : + + public SampleServiceClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : base(binding, remoteAddress) { } - + public string SampleMethod(string msg) { return base.Channel.SampleMethod(msg); diff --git a/samples/snippets/csharp/VS_Snippets_CFX/iinstancecontextinitializer/cs/servicehostcontext.cs b/samples/snippets/csharp/VS_Snippets_CFX/iinstancecontextinitializer/cs/servicehostcontext.cs index a21401efab20b..8da76530e2a37 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/iinstancecontextinitializer/cs/servicehostcontext.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/iinstancecontextinitializer/cs/servicehostcontext.cs @@ -20,7 +20,7 @@ public string ID { get { return this.id.ToString(); } } - + #region IExtension Members public void Attach(ServiceHostBase owner) diff --git a/samples/snippets/csharp/VS_Snippets_CFX/interceptors/cs/client.cs b/samples/snippets/csharp/VS_Snippets_CFX/interceptors/cs/client.cs index 0bea943b08d17..c5ad7534c9b1a 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/interceptors/cs/client.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/interceptors/cs/client.cs @@ -3,7 +3,7 @@ using System.ServiceModel.Channels; using microsoft.wcf.documentation; - + public class Client { public static void Main() @@ -20,7 +20,7 @@ public static void Main() Console.WriteLine("Press ENTER to exit:"); Console.ReadLine(); - // Done with service. + // Done with service. wcfClient.Close(); Console.WriteLine("Done!"); } diff --git a/samples/snippets/csharp/VS_Snippets_CFX/interceptors/cs/insertingbehaviors.cs b/samples/snippets/csharp/VS_Snippets_CFX/interceptors/cs/insertingbehaviors.cs index 3c8604945b59e..c65120798a72f 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/interceptors/cs/insertingbehaviors.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/interceptors/cs/insertingbehaviors.cs @@ -15,9 +15,9 @@ public class InspectorInserter : BehaviorExtensionElement, IServiceBehavior, IEn // #region IServiceBehavior Members public void AddBindingParameters( - ServiceDescription serviceDescription, - ServiceHostBase serviceHostBase, - System.Collections.ObjectModel.Collection endpoints, + ServiceDescription serviceDescription, + ServiceHostBase serviceHostBase, + System.Collections.ObjectModel.Collection endpoints, BindingParameterCollection bindingParameters ) { return; } diff --git a/samples/snippets/csharp/VS_Snippets_CFX/interceptors/cs/interceptors.cs b/samples/snippets/csharp/VS_Snippets_CFX/interceptors/cs/interceptors.cs index fe830bb2660e2..3f96f3508f876 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/interceptors/cs/interceptors.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/interceptors/cs/interceptors.cs @@ -29,8 +29,8 @@ public void BeforeSendReply(ref System.ServiceModel.Channels.Message reply, obje public void AfterCall(string operationName, object[] outputs, object returnValue, object correlationState) { Console.WriteLine( - "IParameterInspector.AfterCall called for {0} with return value {1}.", - operationName, + "IParameterInspector.AfterCall called for {0} with return value {1}.", + operationName, returnValue.ToString() ); } diff --git a/samples/snippets/csharp/VS_Snippets_CFX/interceptors/cs/proxycode.cs b/samples/snippets/csharp/VS_Snippets_CFX/interceptors/cs/proxycode.cs index 5ba693e12cfa4..8f4dddeae533a 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/interceptors/cs/proxycode.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/interceptors/cs/proxycode.cs @@ -13,17 +13,17 @@ namespace microsoft.wcf.documentation { using System.Runtime.Serialization; - - + + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "3.0.0.0")] [System.Runtime.Serialization.DataContractAttribute()] public partial class SampleFault : object, System.Runtime.Serialization.IExtensibleDataObject { - + private System.Runtime.Serialization.ExtensionDataObject extensionDataField; - + private string FaultMessageField; - + public System.Runtime.Serialization.ExtensionDataObject ExtensionData { get @@ -35,7 +35,7 @@ public System.Runtime.Serialization.ExtensionDataObject ExtensionData this.extensionDataField = value; } } - + [System.Runtime.Serialization.DataMemberAttribute()] public string FaultMessage { @@ -56,7 +56,7 @@ public string FaultMessage [System.ServiceModel.ServiceContractAttribute(Namespace="http://microsoft.wcf.documentation", ConfigurationName="ISampleService")] public interface ISampleService { - + [System.ServiceModel.OperationContractAttribute(Action="http://microsoft.wcf.documentation/ISampleService/SampleMethod", ReplyAction="http://microsoft.wcf.documentation/ISampleService/SampleMethodResponse")] [System.ServiceModel.FaultContractAttribute(typeof(microsoft.wcf.documentation.SampleFault), Action="http://microsoft.wcf.documentation/ISampleService/SampleMethodSampleFaultFault", Name="SampleFault")] string SampleMethod(string msg); @@ -71,31 +71,31 @@ public interface ISampleServiceChannel : ISampleService, System.ServiceModel.ICl [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")] public partial class SampleServiceClient : System.ServiceModel.ClientBase, ISampleService { - + public SampleServiceClient() { } - - public SampleServiceClient(string endpointConfigurationName) : + + public SampleServiceClient(string endpointConfigurationName) : base(endpointConfigurationName) { } - - public SampleServiceClient(string endpointConfigurationName, string remoteAddress) : + + public SampleServiceClient(string endpointConfigurationName, string remoteAddress) : base(endpointConfigurationName, remoteAddress) { } - - public SampleServiceClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : + + public SampleServiceClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : base(endpointConfigurationName, remoteAddress) { } - - public SampleServiceClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : + + public SampleServiceClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : base(binding, remoteAddress) { } - + public string SampleMethod(string msg) { return base.Channel.SampleMethod(msg); diff --git a/samples/snippets/csharp/VS_Snippets_CFX/lockdownvalidation/cs/hostapplication.cs b/samples/snippets/csharp/VS_Snippets_CFX/lockdownvalidation/cs/hostapplication.cs index 5c78ac4b085b2..b6d3c5b028e92 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/lockdownvalidation/cs/hostapplication.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/lockdownvalidation/cs/hostapplication.cs @@ -36,16 +36,16 @@ ExtensionsSection extensions = machine.GetSection(@"system.serviceModel/extensions") as ExtensionsSection; if (extensions == null) throw new Exception("not extensions section."); - ExtensionElement validator + ExtensionElement validator = new ExtensionElement( - "internetClientValidator", + "internetClientValidator", "Microsoft.ServiceModel.Samples.InternetClientValidatorElement, InternetClientValidator, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null" ); validator.LockItem = true; if (extensions.BehaviorExtensions.IndexOf(validator) < 0) extensions.BehaviorExtensions.Add(validator); // - + // // Add a new section for our validator and lock it down. // Behaviors for client applications must be endpoint behaviors. @@ -72,8 +72,8 @@ CommonBehaviorsSection commonBehaviors // - diff --git a/samples/snippets/csharp/VS_Snippets_CFX/messageheaderattribute/cs/client.cs b/samples/snippets/csharp/VS_Snippets_CFX/messageheaderattribute/cs/client.cs index 45894a4b56637..f11134ddbcaea 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/messageheaderattribute/cs/client.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/messageheaderattribute/cs/client.cs @@ -2,7 +2,7 @@ using System; using System.ServiceModel; using System.ServiceModel.Channels; - + public class Client { public static void Main() @@ -21,7 +21,7 @@ public static void Main() Console.WriteLine("Press ENTER to exit:"); Console.ReadLine(); - // Done with service. + // Done with service. wcfClient.Close(); Console.WriteLine("Done!"); } diff --git a/samples/snippets/csharp/VS_Snippets_CFX/messageheaderattribute/cs/proxycode.cs b/samples/snippets/csharp/VS_Snippets_CFX/messageheaderattribute/cs/proxycode.cs index c5cb6ac21eff5..c03bda9e8716c 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/messageheaderattribute/cs/proxycode.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/messageheaderattribute/cs/proxycode.cs @@ -14,7 +14,7 @@ [System.ServiceModel.ServiceContractAttribute(Namespace="Microsoft.WCF.Documentation", ConfigurationName="IMessagingHello")] public interface IMessagingHello { - + [System.ServiceModel.OperationContractAttribute(Action="http://GreetingMessage/Action", ReplyAction="http://HelloResponseMessage/Action")] HelloResponseMessage Hello(HelloGreetingMessage request); } @@ -24,14 +24,14 @@ public interface IMessagingHello [System.ServiceModel.MessageContractAttribute(WrapperName="HelloGreetingMessage", WrapperNamespace="Microsoft.WCF.Documentation", IsWrapped=true)] public partial class HelloGreetingMessage { - + [System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://www.examples.com", Order=0)] public string Salutations; - + public HelloGreetingMessage() { } - + public HelloGreetingMessage(string Salutations) { this.Salutations = Salutations; @@ -43,17 +43,17 @@ public HelloGreetingMessage(string Salutations) [System.ServiceModel.MessageContractAttribute(WrapperName="HelloResponseMessage", WrapperNamespace="Microsoft.WCF.Documentation", IsWrapped=true)] public partial class HelloResponseMessage { - + [System.ServiceModel.MessageHeaderAttribute(Namespace="http://www.examples.com")] public string OutOfBandData; - + [System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://www.examples.com", Order=0)] public string ResponseToGreeting; - + public HelloResponseMessage() { } - + public HelloResponseMessage(string OutOfBandData, string ResponseToGreeting) { this.OutOfBandData = OutOfBandData; @@ -70,31 +70,31 @@ public interface IMessagingHelloChannel : IMessagingHello, System.ServiceModel.I [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")] public partial class MessagingHelloClient : System.ServiceModel.ClientBase, IMessagingHello { - + public MessagingHelloClient() { } - - public MessagingHelloClient(string endpointConfigurationName) : + + public MessagingHelloClient(string endpointConfigurationName) : base(endpointConfigurationName) { } - - public MessagingHelloClient(string endpointConfigurationName, string remoteAddress) : + + public MessagingHelloClient(string endpointConfigurationName, string remoteAddress) : base(endpointConfigurationName, remoteAddress) { } - - public MessagingHelloClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : + + public MessagingHelloClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : base(endpointConfigurationName, remoteAddress) { } - - public MessagingHelloClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : + + public MessagingHelloClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : base(binding, remoteAddress) { } - + public HelloResponseMessage Hello(HelloGreetingMessage request) { return base.Channel.Hello(request); diff --git a/samples/snippets/csharp/VS_Snippets_CFX/messageheaderattribute/cs/services.cs b/samples/snippets/csharp/VS_Snippets_CFX/messageheaderattribute/cs/services.cs index ecbf32a9ccfe9..bc82ee16d5fad 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/messageheaderattribute/cs/services.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/messageheaderattribute/cs/services.cs @@ -48,7 +48,7 @@ public string ExtraValues /* The following is the response message, edited for clarity. - + http://HelloResponseMessage/Action @@ -58,7 +58,7 @@ public string ExtraValues Service received: Hello. - + */ } @@ -70,7 +70,7 @@ public class HelloGreetingMessage private string localGreeting; [MessageBodyMember( - Name = "Salutations", + Name = "Salutations", Namespace = "http://www.examples.com" )] public string Greeting @@ -82,11 +82,11 @@ public string Greeting /* The following is the request message, edited for clarity. - + {0:O}", dat, dat.Kind); - - DateTime uDat = new DateTime(2009, 6, 15, 13, 45, 30, + Console.WriteLine("{0} ({1}) --> {0:O}", dat, dat.Kind); + + DateTime uDat = new DateTime(2009, 6, 15, 13, 45, 30, DateTimeKind.Utc); Console.WriteLine("{0} ({1}) --> {0:O}", uDat, uDat.Kind); - - DateTime lDat = new DateTime(2009, 6, 15, 13, 45, 30, + + DateTime lDat = new DateTime(2009, 6, 15, 13, 45, 30, DateTimeKind.Local); Console.WriteLine("{0} ({1}) --> {0:O}\n", lDat, lDat.Kind); - + DateTimeOffset dto = new DateTimeOffset(lDat); Console.WriteLine("{0} --> {0:O}", dto); } @@ -25,6 +25,6 @@ public static void Main() // 6/15/2009 1:45:30 PM (Unspecified) --> 2009-06-15T13:45:30.0000000 // 6/15/2009 1:45:30 PM (Utc) --> 2009-06-15T13:45:30.0000000Z // 6/15/2009 1:45:30 PM (Local) --> 2009-06-15T13:45:30.0000000-07:00 -// +// // 6/15/2009 1:45:30 PM -07:00 --> 2009-06-15T13:45:30.0000000-07:00 // diff --git a/samples/snippets/csharp/VS_Snippets_CLR/Formatting.Enum/cs/enum1.cs b/samples/snippets/csharp/VS_Snippets_CLR/Formatting.Enum/cs/enum1.cs index 3e67c6479346e..33e3ed03db3c0 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/Formatting.Enum/cs/enum1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/Formatting.Enum/cs/enum1.cs @@ -11,7 +11,7 @@ public static void Main() { ShowGSpecifier(); ShowFSpecifier(); - ShowDSpecifier(); + ShowDSpecifier(); ShowXSpecifier(); ShowExample(); } @@ -23,23 +23,23 @@ private static void ShowGSpecifier() Console.WriteLine(ConsoleColor.Red.ToString("G")); // Displays Red FileAttributes attributes = FileAttributes.Hidden | FileAttributes.Archive; - Console.WriteLine(attributes.ToString("G")); // Displays Hidden, Archive + Console.WriteLine(attributes.ToString("G")); // Displays Hidden, Archive // Console.WriteLine(); } - + private static void ShowFSpecifier() { Console.WriteLine("F Specifier:"); // Console.WriteLine(ConsoleColor.Blue.ToString("F")); // Displays Blue - FileAttributes attributes = FileAttributes.Hidden | + FileAttributes attributes = FileAttributes.Hidden | FileAttributes.Archive; - Console.WriteLine(attributes.ToString("F")); // Displays Hidden, Archive + Console.WriteLine(attributes.ToString("F")); // Displays Hidden, Archive // Console.WriteLine(); } - + private static void ShowDSpecifier() { Console.WriteLine("D Specifier:"); @@ -47,11 +47,11 @@ private static void ShowDSpecifier() Console.WriteLine(ConsoleColor.Cyan.ToString("D")); // Displays 11 FileAttributes attributes = FileAttributes.Hidden | FileAttributes.Archive; - Console.WriteLine(attributes.ToString("D")); // Displays 34 + Console.WriteLine(attributes.ToString("D")); // Displays 34 // Console.WriteLine(); } - + private static void ShowXSpecifier() { Console.WriteLine("X Specifier:"); @@ -59,7 +59,7 @@ private static void ShowXSpecifier() Console.WriteLine(ConsoleColor.Cyan.ToString("X")); // Displays 0000000B FileAttributes attributes = FileAttributes.Hidden | FileAttributes.Archive; - Console.WriteLine(attributes.ToString("X")); // Displays 00000022 + Console.WriteLine(attributes.ToString("X")); // Displays 00000022 // Console.WriteLine(); } @@ -68,23 +68,23 @@ private static void ShowExample() { Console.WriteLine("Example:"); // - Color myColor = Color.Green; + Color myColor = Color.Green; // - + // - Console.WriteLine("The value of myColor is {0}.", + Console.WriteLine("The value of myColor is {0}.", myColor.ToString("G")); - Console.WriteLine("The value of myColor is {0}.", + Console.WriteLine("The value of myColor is {0}.", myColor.ToString("F")); - Console.WriteLine("The value of myColor is {0}.", + Console.WriteLine("The value of myColor is {0}.", myColor.ToString("D")); - Console.WriteLine("The value of myColor is 0x{0}.", + Console.WriteLine("The value of myColor is 0x{0}.", myColor.ToString("X")); // The example displays the following output to the console: // The value of myColor is Green. // The value of myColor is Green. // The value of myColor is 3. - // The value of myColor is 0x00000003. + // The value of myColor is 0x00000003. // } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/Formatting.HowTo.Calendar/cs/Calendar1.cs b/samples/snippets/csharp/VS_Snippets_CLR/Formatting.HowTo.Calendar/cs/Calendar1.cs index 1f1226468e6d8..33d44ed08cda4 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/Formatting.HowTo.Calendar/cs/Calendar1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/Formatting.HowTo.Calendar/cs/Calendar1.cs @@ -9,15 +9,15 @@ public static void Main() HijriCalendar hijriCal = new HijriCalendar(); CalendarUtility hijriUtil = new CalendarUtility(hijriCal); DateTime dateValue1 = new DateTime(1429, 6, 29, hijriCal); - DateTimeOffset dateValue2 = new DateTimeOffset(dateValue1, + DateTimeOffset dateValue2 = new DateTimeOffset(dateValue1, TimeZoneInfo.Local.GetUtcOffset(dateValue1)); CultureInfo jc = CultureInfo.CreateSpecificCulture("ar-JO"); // Display the date using the Gregorian calendar. - Console.WriteLine("Using the system default culture: {0}", + Console.WriteLine("Using the system default culture: {0}", dateValue1.ToString("d")); // Display the date using the ar-JO culture's original default calendar. - Console.WriteLine("Using the ar-JO culture's original default calendar: {0}", + Console.WriteLine("Using the ar-JO culture's original default calendar: {0}", dateValue1.ToString("d", jc)); // Display the date using the Hijri calendar. Console.WriteLine("Using the ar-JO culture with Hijri as the default calendar:"); @@ -25,15 +25,15 @@ public static void Main() Console.WriteLine(hijriUtil.DisplayDate(dateValue1, jc)); // Display a DateTimeOffset value. Console.WriteLine(hijriUtil.DisplayDate(dateValue2, jc)); - + Console.WriteLine(); - + PersianCalendar persianCal = new PersianCalendar(); CalendarUtility persianUtil = new CalendarUtility(persianCal); CultureInfo ic = CultureInfo.CreateSpecificCulture("fa-IR"); - + // Display the date using the ir-FA culture's default calendar. - Console.WriteLine("Using the ir-FA culture's default calendar: {0}", + Console.WriteLine("Using the ir-FA culture's default calendar: {0}", dateValue1.ToString("d", ic)); // Display a Date value. Console.WriteLine(persianUtil.DisplayDate(dateValue1, ic)); @@ -46,7 +46,7 @@ public class CalendarUtility { private Calendar thisCalendar; private CultureInfo targetCulture; - + public CalendarUtility(Calendar cal) { this.thisCalendar = cal; @@ -55,7 +55,7 @@ public CalendarUtility(Calendar cal) private bool CalendarExists(CultureInfo culture) { this.targetCulture = culture; - return Array.Exists(this.targetCulture.OptionalCalendars, + return Array.Exists(this.targetCulture.OptionalCalendars, this.HasSameName); } @@ -73,32 +73,32 @@ public string DisplayDate(DateTime dateToDisplay, CultureInfo culture) return DisplayDate(displayOffsetDate, culture); } - public string DisplayDate(DateTimeOffset dateToDisplay, + public string DisplayDate(DateTimeOffset dateToDisplay, CultureInfo culture) { string specifier = "yyyy/MM/dd"; - + if (this.CalendarExists(culture)) { - Console.WriteLine("Displaying date in supported {0} calendar...", + Console.WriteLine("Displaying date in supported {0} calendar...", this.thisCalendar.GetType().Name); culture.DateTimeFormat.Calendar = this.thisCalendar; return dateToDisplay.ToString(specifier, culture); } else { - Console.WriteLine("Displaying date in unsupported {0} calendar...", + Console.WriteLine("Displaying date in unsupported {0} calendar...", thisCalendar.GetType().Name); - + string separator = targetCulture.DateTimeFormat.DateSeparator; - + return thisCalendar.GetYear(dateToDisplay.DateTime).ToString("0000") + separator + - thisCalendar.GetMonth(dateToDisplay.DateTime).ToString("00") + + thisCalendar.GetMonth(dateToDisplay.DateTime).ToString("00") + separator + - thisCalendar.GetDayOfMonth(dateToDisplay.DateTime).ToString("00"); + thisCalendar.GetDayOfMonth(dateToDisplay.DateTime).ToString("00"); } - } + } } // The example displays the following output to the console: // Using the system default culture: 7/3/2008 @@ -108,7 +108,7 @@ public string DisplayDate(DateTimeOffset dateToDisplay, // 1429/06/29 // Displaying date in supported HijriCalendar calendar... // 1429/06/29 -// +// // Using the ir-FA culture's default calendar: 7/3/2008 // Displaying date in unsupported PersianCalendar calendar... // 1387/04/13 @@ -122,7 +122,7 @@ public static void BadDate() { // PersianCalendar persianCal = new PersianCalendar(); - + DateTime persianDate = persianCal.ToDateTime(1387, 3, 18, 12, 0, 0, 0); Console.WriteLine(persianDate.ToString()); diff --git a/samples/snippets/csharp/VS_Snippets_CLR/Formatting.HowTo.Millisecond/cs/Millisecond.cs b/samples/snippets/csharp/VS_Snippets_CLR/Formatting.HowTo.Millisecond/cs/Millisecond.cs index 8c2e7b99bcc22..f4645265c0c84 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/Formatting.HowTo.Millisecond/cs/Millisecond.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/Formatting.HowTo.Millisecond/cs/Millisecond.cs @@ -8,30 +8,30 @@ public class MillisecondDisplay public static void Main() { string dateString = "7/16/2008 8:32:45.126 AM"; - + try { DateTime dateValue = DateTime.Parse(dateString); DateTimeOffset dateOffsetValue = DateTimeOffset.Parse(dateString); - + // Display Millisecond component alone. - Console.WriteLine("Millisecond component only: {0}", + Console.WriteLine("Millisecond component only: {0}", dateValue.ToString("fff")); - Console.WriteLine("Millisecond component only: {0}", + Console.WriteLine("Millisecond component only: {0}", dateOffsetValue.ToString("fff")); - + // Display Millisecond component with full date and time. - Console.WriteLine("Date and Time with Milliseconds: {0}", - dateValue.ToString("MM/dd/yyyy hh:mm:ss.fff tt")); - Console.WriteLine("Date and Time with Milliseconds: {0}", + Console.WriteLine("Date and Time with Milliseconds: {0}", + dateValue.ToString("MM/dd/yyyy hh:mm:ss.fff tt")); + Console.WriteLine("Date and Time with Milliseconds: {0}", dateOffsetValue.ToString("MM/dd/yyyy hh:mm:ss.fff tt")); - + // Append millisecond pattern to current culture's full date time pattern string fullPattern = DateTimeFormatInfo.CurrentInfo.FullDateTimePattern; fullPattern = Regex.Replace(fullPattern, "(:ss|:s)", "$1.fff"); - + // Display Millisecond component with modified full date and time pattern. - Console.WriteLine("Modified full date time pattern: {0}", + Console.WriteLine("Modified full date time pattern: {0}", dateValue.ToString(fullPattern)); Console.WriteLine("Modified full date time pattern: {0}", dateOffsetValue.ToString(fullPattern)); @@ -56,26 +56,26 @@ public class AdditionalSnippets public static void Show() { // - DateTime dateValue = new DateTime(2008, 7, 16, 8, 32, 45, 180); - Console.WriteLine(dateValue.ToString("fff")); + DateTime dateValue = new DateTime(2008, 7, 16, 8, 32, 45, 180); + Console.WriteLine(dateValue.ToString("fff")); Console.WriteLine(dateValue.ToString("FFF")); // The example displays the following output to the console: // 180 - // 18 + // 18 // } public static void Show2() { // - DateTime dateValue = new DateTime(2008, 7, 16, 8, 32, 45, 180); + DateTime dateValue = new DateTime(2008, 7, 16, 8, 32, 45, 180); Console.WriteLine("{0} seconds", dateValue.ToString("s.f")); - Console.WriteLine("{0} seconds", dateValue.ToString("s.ff")); + Console.WriteLine("{0} seconds", dateValue.ToString("s.ff")); Console.WriteLine("{0} seconds", dateValue.ToString("s.ffff")); // The example displays the following output to the console: // 45.1 seconds // 45.18 seconds // 45.1800 seconds - // + // } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/Formatting.HowTo.NumericValue/cs/Telephone1.cs b/samples/snippets/csharp/VS_Snippets_CLR/Formatting.HowTo.NumericValue/cs/Telephone1.cs index 34f5fcc225ead..26e5a802891c7 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/Formatting.HowTo.NumericValue/cs/Telephone1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/Formatting.HowTo.NumericValue/cs/Telephone1.cs @@ -10,32 +10,32 @@ public object GetFormat(Type formatType) return this; else return null; - } + } public string Format(string format, object arg, IFormatProvider formatProvider) { - // Check whether this is an appropriate callback + // Check whether this is an appropriate callback if (! this.Equals(formatProvider)) - return null; + return null; - // Set default format specifier - if (string.IsNullOrEmpty(format)) + // Set default format specifier + if (string.IsNullOrEmpty(format)) format = "N"; string numericString = arg.ToString(); - + if (format == "N") { if (numericString.Length <= 4) return numericString; else if (numericString.Length == 7) - return numericString.Substring(0, 3) + "-" + numericString.Substring(3, 4); + return numericString.Substring(0, 3) + "-" + numericString.Substring(3, 4); else if (numericString.Length == 10) return "(" + numericString.Substring(0, 3) + ") " + - numericString.Substring(3, 3) + "-" + numericString.Substring(6); + numericString.Substring(3, 3) + "-" + numericString.Substring(6); else - throw new FormatException( - string.Format("'{0}' cannot be used to format {1}.", + throw new FormatException( + string.Format("'{0}' cannot be used to format {1}.", format, arg.ToString())); } else if (format == "I") @@ -48,8 +48,8 @@ public string Format(string format, object arg, IFormatProvider formatProvider) else { throw new FormatException(string.Format("The {0} format specifier is invalid.", format)); - } - return numericString; + } + return numericString; } } @@ -63,7 +63,7 @@ public static void Main() // Console.WriteLine(String.Format(new TelephoneFormatter(), "{0}", 4257884748)); // - + Console.WriteLine(String.Format(new TelephoneFormatter(), "{0:N}", 0)); Console.WriteLine(String.Format(new TelephoneFormatter(), "{0:N}", 911)); Console.WriteLine(String.Format(new TelephoneFormatter(), "{0:N}", 8490216)); diff --git a/samples/snippets/csharp/VS_Snippets_CLR/Formatting.HowTo.PadNumber/cs/Pad1.cs b/samples/snippets/csharp/VS_Snippets_CLR/Formatting.HowTo.PadNumber/cs/Pad1.cs index 0f0327d3dd3bb..247a70817733a 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/Formatting.HowTo.PadNumber/cs/Pad1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/Formatting.HowTo.PadNumber/cs/Pad1.cs @@ -19,9 +19,9 @@ private static void PadInteger() byte byteValue = 254; short shortValue = 10342; int intValue = 1023983; - long lngValue = 6985321; + long lngValue = 6985321; ulong ulngValue = UInt64.MaxValue; - + // Display integer values by calling the ToString method. Console.WriteLine("{0,22} {1,22}", byteValue.ToString("D8"), byteValue.ToString("X8")); Console.WriteLine("{0,22} {1,22}", shortValue.ToString("D8"), shortValue.ToString("X8")); @@ -29,7 +29,7 @@ private static void PadInteger() Console.WriteLine("{0,22} {1,22}", lngValue.ToString("D8"), lngValue.ToString("X8")); Console.WriteLine("{0,22} {1,22}", ulngValue.ToString("D8"), ulngValue.ToString("X8")); Console.WriteLine(); - + // Display the same integer values by using composite formatting. Console.WriteLine("{0,22:D8} {0,22:X8}", byteValue); Console.WriteLine("{0,22:D8} {0,22:X8}", shortValue); @@ -42,7 +42,7 @@ private static void PadInteger() // 01023983 000F9FEF // 06985321 006A9669 // 18446744073709551615 FFFFFFFFFFFFFFFF - // + // // 00000254 000000FE // 00010342 00002866 // 01023983 000F9FEF @@ -62,7 +62,7 @@ private static void PadIntegerWithNZeroes() Console.WriteLine(value.ToString("X" + hexLength.ToString())); // The example displays the following output: // 00000160934 - // 00000274A6 + // 00000274A6 // } @@ -74,33 +74,33 @@ private static void PadNumber() decimal decValue = 103932.52m; float sngValue = 1549230.10873992f; double dblValue = 9034521202.93217412; - + // Display the numbers using the ToString method. Console.WriteLine(intValue.ToString(fmt)); - Console.WriteLine(decValue.ToString(fmt)); + Console.WriteLine(decValue.ToString(fmt)); Console.WriteLine(sngValue.ToString(fmt)); - Console.WriteLine(dblValue.ToString(fmt)); + Console.WriteLine(dblValue.ToString(fmt)); Console.WriteLine(); - + // Display the numbers using composite formatting. string formatString = " {0,15:" + fmt + "}"; - Console.WriteLine(formatString, intValue); - Console.WriteLine(formatString, decValue); - Console.WriteLine(formatString, sngValue); - Console.WriteLine(formatString, dblValue); + Console.WriteLine(formatString, intValue); + Console.WriteLine(formatString, decValue); + Console.WriteLine(formatString, sngValue); + Console.WriteLine(formatString, dblValue); // The example displays the following output: // 01053240 // 00103932.52 // 01549230 // 9034521202.93 - // + // // 01053240 // 00103932.52 // 01549230 - // 9034521202.93 + // 9034521202.93 // } - + private static void PadNumberWithNZeroes() { // @@ -109,7 +109,7 @@ private static void PadNumberWithNZeroes() { string decSeparator = System.Globalization.NumberFormatInfo.CurrentInfo.NumberDecimalSeparator; string fmt, formatString; - + if (dblValue.ToString().Contains(decSeparator)) { int digits = dblValue.ToString().IndexOf(decSeparator); @@ -117,7 +117,7 @@ private static void PadNumberWithNZeroes() } else { - fmt = new String('0', dblValue.ToString().Length); + fmt = new String('0', dblValue.ToString().Length); } formatString = "{0,20:" + fmt + "}"; @@ -128,7 +128,7 @@ private static void PadNumberWithNZeroes() // 000009034521202.93 // 000009034521202.93 // 9034521202 - // 9034521202 + // 9034521202 // } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/Formatting.HowTo.RoundTrip/cs/RoundTrip.cs b/samples/snippets/csharp/VS_Snippets_CLR/Formatting.HowTo.RoundTrip/cs/RoundTrip.cs index 010353dd8f224..840602274b8d2 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/Formatting.HowTo.RoundTrip/cs/RoundTrip.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/Formatting.HowTo.RoundTrip/cs/RoundTrip.cs @@ -23,26 +23,26 @@ private static void RoundTripDateTime() StreamWriter outFile = new StreamWriter(fileName); // Save DateTime value. - DateTime dateToSave = DateTime.SpecifyKind(new DateTime(2008, 6, 12, 18, 45, 15), + DateTime dateToSave = DateTime.SpecifyKind(new DateTime(2008, 6, 12, 18, 45, 15), DateTimeKind.Local); - string dateString = dateToSave.ToString("o"); - Console.WriteLine("Converted {0} ({1}) to {2}.", - dateToSave.ToString(), - dateToSave.Kind.ToString(), - dateString); + string dateString = dateToSave.ToString("o"); + Console.WriteLine("Converted {0} ({1}) to {2}.", + dateToSave.ToString(), + dateToSave.Kind.ToString(), + dateString); outFile.WriteLine(dateString); Console.WriteLine("Wrote {0} to {1}.", dateString, fileName); outFile.Close(); - + // Restore DateTime value. DateTime restoredDate; - + StreamReader inFile = new StreamReader(fileName); dateString = inFile.ReadLine(); inFile.Close(); restoredDate = DateTime.Parse(dateString, null, DateTimeStyles.RoundtripKind); - Console.WriteLine("Read {0} ({2}) from {1}.", restoredDate.ToString(), - fileName, + Console.WriteLine("Read {0} ({2}) from {1}.", restoredDate.ToString(), + fileName, restoredDate.Kind.ToString()); // The example displays the following output: // Converted 6/12/2008 6:45:15 PM (Local) to 2008-06-12T18:45:15.0000000-05:00. @@ -50,7 +50,7 @@ private static void RoundTripDateTime() // Read 6/12/2008 6:45:15 PM (Local) from .\DateFile.txt. // } - + private static void RoundTripDateTimeOffset() { // @@ -59,24 +59,24 @@ private static void RoundTripDateTimeOffset() StreamWriter outFile = new StreamWriter(fileName); // Save DateTime value. - DateTimeOffset dateToSave = new DateTimeOffset(2008, 6, 12, 18, 45, 15, + DateTimeOffset dateToSave = new DateTimeOffset(2008, 6, 12, 18, 45, 15, new TimeSpan(7, 0, 0)); - string dateString = dateToSave.ToString("o"); - Console.WriteLine("Converted {0} to {1}.", dateToSave.ToString(), - dateString); + string dateString = dateToSave.ToString("o"); + Console.WriteLine("Converted {0} to {1}.", dateToSave.ToString(), + dateString); outFile.WriteLine(dateString); Console.WriteLine("Wrote {0} to {1}.", dateString, fileName); outFile.Close(); - + // Restore DateTime value. DateTimeOffset restoredDateOff; - + StreamReader inFile = new StreamReader(fileName); dateString = inFile.ReadLine(); inFile.Close(); - restoredDateOff = DateTimeOffset.Parse(dateString, null, + restoredDateOff = DateTimeOffset.Parse(dateString, null, DateTimeStyles.RoundtripKind); - Console.WriteLine("Read {0} from {1}.", restoredDateOff.ToString(), + Console.WriteLine("Read {0} from {1}.", restoredDateOff.ToString(), fileName); // The example displays the following output: // Converted 6/12/2008 6:45:15 PM +07:00 to 2008-06-12T18:45:15.0000000+07:00. @@ -92,19 +92,19 @@ private static void RoundTripTimeWithTimeZone() DateTime tempDate = new DateTime(2008, 9, 3, 19, 0, 0); TimeZoneInfo tempTz = TimeZoneInfo.FindSystemTimeZoneById("Central Standard Time"); - DateInTimeZone dateWithTz = new DateInTimeZone(new DateTimeOffset(tempDate, - tempTz.GetUtcOffset(tempDate)), + DateInTimeZone dateWithTz = new DateInTimeZone(new DateTimeOffset(tempDate, + tempTz.GetUtcOffset(tempDate)), tempTz); - + // Store DateInTimeZone value to a file FileStream outFile = new FileStream(fileName, FileMode.Create); try { BinaryFormatter formatter = new BinaryFormatter(); formatter.Serialize(outFile, dateWithTz); - Console.WriteLine("Saving {0} {1} to {2}", dateWithTz.DateAndTime, - dateWithTz.TimeZone.IsDaylightSavingTime(dateWithTz.DateAndTime) ? - dateWithTz.TimeZone.DaylightName : dateWithTz.TimeZone.DaylightName, + Console.WriteLine("Saving {0} {1} to {2}", dateWithTz.DateAndTime, + dateWithTz.TimeZone.IsDaylightSavingTime(dateWithTz.DateAndTime) ? + dateWithTz.TimeZone.DaylightName : dateWithTz.TimeZone.DaylightName, fileName); } catch (SerializationException) @@ -112,10 +112,10 @@ private static void RoundTripTimeWithTimeZone() Console.WriteLine("Unable to serialize time data to {0}.", fileName); } finally - { + { outFile.Close(); } - + // Retrieve DateInTimeZone value if (File.Exists(fileName)) { @@ -124,15 +124,15 @@ private static void RoundTripTimeWithTimeZone() try { BinaryFormatter formatter = new BinaryFormatter(); - dateWithTz2 = formatter.Deserialize(inFile) as DateInTimeZone; - Console.WriteLine("Restored {0} {1} from {2}", dateWithTz2.DateAndTime, - dateWithTz2.TimeZone.IsDaylightSavingTime(dateWithTz2.DateAndTime) ? - dateWithTz2.TimeZone.DaylightName : dateWithTz2.TimeZone.DaylightName, + dateWithTz2 = formatter.Deserialize(inFile) as DateInTimeZone; + Console.WriteLine("Restored {0} {1} from {2}", dateWithTz2.DateAndTime, + dateWithTz2.TimeZone.IsDaylightSavingTime(dateWithTz2.DateAndTime) ? + dateWithTz2.TimeZone.DaylightName : dateWithTz2.TimeZone.DaylightName, fileName); } catch (SerializationException) { - Console.WriteLine("Unable to retrieve date and time information from {0}", + Console.WriteLine("Unable to retrieve date and time information from {0}", fileName); } finally @@ -142,7 +142,7 @@ private static void RoundTripTimeWithTimeZone() } // This example displays the following output to the console: // Saving 9/3/2008 7:00:00 PM -05:00 Central Daylight Time to .\DateWithTz.dat - // Restored 9/3/2008 7:00:00 PM -05:00 Central Daylight Time from .\DateWithTz.dat + // Restored 9/3/2008 7:00:00 PM -05:00 Central Daylight Time from .\DateWithTz.dat // } } @@ -152,31 +152,31 @@ [Serializable] public class DateInTimeZone { private TimeZoneInfo tz; private DateTimeOffset thisDate; - + public DateInTimeZone() {} public DateInTimeZone(DateTimeOffset date, TimeZoneInfo timeZone) { - if (timeZone == null) + if (timeZone == null) throw new ArgumentNullException("The time zone cannot be null."); this.thisDate = date; this.tz = timeZone; } - + public DateTimeOffset DateAndTime { - get { + get { return this.thisDate; } set { - if (value.Offset != this.tz.GetUtcOffset(value)) + if (value.Offset != this.tz.GetUtcOffset(value)) this.thisDate = TimeZoneInfo.ConvertTime(value, tz); else this.thisDate = value; } } - + public TimeZoneInfo TimeZone { get { diff --git a/samples/snippets/csharp/VS_Snippets_CLR/Formatting.HowTo.WeekdayName/cs/Howto1.cs b/samples/snippets/csharp/VS_Snippets_CLR/Formatting.HowTo.WeekdayName/cs/Howto1.cs index 5846072ea3bd4..a9e979798a236 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/Formatting.HowTo.WeekdayName/cs/Howto1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/Formatting.HowTo.WeekdayName/cs/Howto1.cs @@ -13,7 +13,7 @@ public static void Main() DateTime dateValue = new DateTime(2008, 6, 11); // Display the DayOfWeek string representation - Console.WriteLine(dateValue.DayOfWeek.ToString()); + Console.WriteLine(dateValue.DayOfWeek.ToString()); // Restore original current culture Thread.CurrentThread.CurrentCulture = originalCulture; } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/Formatting.HowTo.WeekdayName/cs/abbrname1.cs b/samples/snippets/csharp/VS_Snippets_CLR/Formatting.HowTo.WeekdayName/cs/abbrname1.cs index 78d2865a2f75e..581f7736ab5b6 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/Formatting.HowTo.WeekdayName/cs/abbrname1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/Formatting.HowTo.WeekdayName/cs/abbrname1.cs @@ -6,7 +6,7 @@ public class Example public static void Main() { DateTime dateValue = new DateTime(2008, 6, 11); - Console.WriteLine(dateValue.ToString("ddd")); + Console.WriteLine(dateValue.ToString("ddd")); } } // The example displays the following output: diff --git a/samples/snippets/csharp/VS_Snippets_CLR/Formatting.HowTo.WeekdayName/cs/abbrname2.cs b/samples/snippets/csharp/VS_Snippets_CLR/Formatting.HowTo.WeekdayName/cs/abbrname2.cs index 9b7818a059472..50fbad347c7bb 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/Formatting.HowTo.WeekdayName/cs/abbrname2.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/Formatting.HowTo.WeekdayName/cs/abbrname2.cs @@ -7,10 +7,10 @@ public class Example public static void Main() { DateTime dateValue = new DateTime(2008, 6, 11); - Console.WriteLine(dateValue.ToString("ddd", - new CultureInfo("fr-FR"))); + Console.WriteLine(dateValue.ToString("ddd", + new CultureInfo("fr-FR"))); } } // The example displays the following output: -// mer. +// mer. // diff --git a/samples/snippets/csharp/VS_Snippets_CLR/Formatting.HowTo.WeekdayName/cs/example6.cs b/samples/snippets/csharp/VS_Snippets_CLR/Formatting.HowTo.WeekdayName/cs/example6.cs index 869d90fb968e2..71ea84524ee67 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/Formatting.HowTo.WeekdayName/cs/example6.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/Formatting.HowTo.WeekdayName/cs/example6.cs @@ -9,40 +9,40 @@ public static void Main() string dateString = "6/11/2007"; DateTime dateValue; DateTimeOffset dateOffsetValue; - + try { DateTimeFormatInfo dateTimeFormats; // Convert date representation to a date value dateValue = DateTime.Parse(dateString, CultureInfo.InvariantCulture); - dateOffsetValue = new DateTimeOffset(dateValue, - TimeZoneInfo.Local.GetUtcOffset(dateValue)); + dateOffsetValue = new DateTimeOffset(dateValue, + TimeZoneInfo.Local.GetUtcOffset(dateValue)); // Convert date representation to a number indicating the day of week Console.WriteLine((int) dateValue.DayOfWeek); Console.WriteLine((int) dateOffsetValue.DayOfWeek); - + // Display abbreviated weekday name using current culture Console.WriteLine(dateValue.ToString("ddd")); Console.WriteLine(dateOffsetValue.ToString("ddd")); - + // Display full weekday name using current culture Console.WriteLine(dateValue.ToString("dddd")); Console.WriteLine(dateOffsetValue.ToString("dddd")); - + // Display abbreviated weekday name for de-DE culture Console.WriteLine(dateValue.ToString("ddd", new CultureInfo("de-DE"))); - Console.WriteLine(dateOffsetValue.ToString("ddd", + Console.WriteLine(dateOffsetValue.ToString("ddd", new CultureInfo("de-DE"))); - + // Display abbreviated weekday name with de-DE DateTimeFormatInfo object dateTimeFormats = new CultureInfo("de-DE").DateTimeFormat; Console.WriteLine(dateValue.ToString("ddd", dateTimeFormats)); Console.WriteLine(dateOffsetValue.ToString("ddd", dateTimeFormats)); - + // Display full weekday name for fr-FR culture Console.WriteLine(dateValue.ToString("ddd", new CultureInfo("fr-FR"))); - Console.WriteLine(dateOffsetValue.ToString("ddd", + Console.WriteLine(dateOffsetValue.ToString("ddd", new CultureInfo("fr-FR"))); // Display abbreviated weekday name with fr-FR DateTimeFormatInfo object diff --git a/samples/snippets/csharp/VS_Snippets_CLR/Formatting.HowTo.WeekdayName/cs/fullname4.cs b/samples/snippets/csharp/VS_Snippets_CLR/Formatting.HowTo.WeekdayName/cs/fullname4.cs index 5eb29e666d6d3..3028c16967a2d 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/Formatting.HowTo.WeekdayName/cs/fullname4.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/Formatting.HowTo.WeekdayName/cs/fullname4.cs @@ -6,7 +6,7 @@ public class Example public static void Main() { DateTime dateValue = new DateTime(2008, 6, 11); - Console.WriteLine(dateValue.ToString("dddd")); + Console.WriteLine(dateValue.ToString("dddd")); } } // The example displays the following output: diff --git a/samples/snippets/csharp/VS_Snippets_CLR/Formatting.HowTo.WeekdayName/cs/fullname5.cs b/samples/snippets/csharp/VS_Snippets_CLR/Formatting.HowTo.WeekdayName/cs/fullname5.cs index 4fe307d19bc0d..41b1a1152fcd7 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/Formatting.HowTo.WeekdayName/cs/fullname5.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/Formatting.HowTo.WeekdayName/cs/fullname5.cs @@ -7,8 +7,8 @@ public class Example public static void Main() { DateTime dateValue = new DateTime(2008, 6, 11); - Console.WriteLine(dateValue.ToString("dddd", - new CultureInfo("es-ES"))); + Console.WriteLine(dateValue.ToString("dddd", + new CultureInfo("es-ES"))); } } // The example displays the following output: diff --git a/samples/snippets/csharp/VS_Snippets_CLR/Formatting.HowTo.WeekdayName/cs/weekdaynumber7.cs b/samples/snippets/csharp/VS_Snippets_CLR/Formatting.HowTo.WeekdayName/cs/weekdaynumber7.cs index a48f0ba485874..143fc0a634808 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/Formatting.HowTo.WeekdayName/cs/weekdaynumber7.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/Formatting.HowTo.WeekdayName/cs/weekdaynumber7.cs @@ -6,7 +6,7 @@ public class Example public static void Main() { DateTime dateValue = new DateTime(2008, 6, 11); - Console.WriteLine((int) dateValue.DayOfWeek); + Console.WriteLine((int) dateValue.DayOfWeek); } } // The example displays the following output: diff --git a/samples/snippets/csharp/VS_Snippets_CLR/Formatting.Numeric.Standard/cs/Standard.cs b/samples/snippets/csharp/VS_Snippets_CLR/Formatting.Numeric.Standard/cs/Standard.cs index 41ef53e42f326..8dfd0a6e09885 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/Formatting.Numeric.Standard/cs/Standard.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/Formatting.Numeric.Standard/cs/Standard.cs @@ -36,7 +36,7 @@ public static void Main() Console.WriteLine("Hexadecimal Format Specifier:"); ShowHex(); } - + public static void ShowCurrency() { // @@ -45,21 +45,21 @@ public static void ShowCurrency() Console.WriteLine(value.ToString("C3", CultureInfo.CurrentCulture)); - Console.WriteLine(value.ToString("C3", + Console.WriteLine(value.ToString("C3", CultureInfo.CreateSpecificCulture("da-DK"))); // The example displays the following output on a system whose // current culture is English (United States): // $12,345.68 // $12,345.679 // 12.345,679 kr - // + // } - + public static void ShowDecimal() { // - int value; - + int value; + value = 12345; Console.WriteLine(value.ToString("D")); // Displays 12345 @@ -73,80 +73,80 @@ public static void ShowDecimal() // Displays -00012345 // } - + public static void ShowExponentiation() { // double value = 12345.6789; Console.WriteLine(value.ToString("E", CultureInfo.InvariantCulture)); // Displays 1.234568E+004 - + Console.WriteLine(value.ToString("E10", CultureInfo.InvariantCulture)); // Displays 1.2345678900E+004 - + Console.WriteLine(value.ToString("e4", CultureInfo.InvariantCulture)); // Displays 1.2346e+004 - - Console.WriteLine(value.ToString("E", + + Console.WriteLine(value.ToString("E", CultureInfo.CreateSpecificCulture("fr-FR"))); // Displays 1,234568E+004 // } - + public static void ShowFixedPoint() { // int integerNumber; integerNumber = 17843; - Console.WriteLine(integerNumber.ToString("F", + Console.WriteLine(integerNumber.ToString("F", CultureInfo.InvariantCulture)); // Displays 17843.00 - + integerNumber = -29541; - Console.WriteLine(integerNumber.ToString("F3", + Console.WriteLine(integerNumber.ToString("F3", CultureInfo.InvariantCulture)); // Displays -29541.000 - + double doubleNumber; doubleNumber = 18934.1879; Console.WriteLine(doubleNumber.ToString("F", CultureInfo.InvariantCulture)); // Displays 18934.19 - + Console.WriteLine(doubleNumber.ToString("F0", CultureInfo.InvariantCulture)); // Displays 18934 - + doubleNumber = -1898300.1987; - Console.WriteLine(doubleNumber.ToString("F1", CultureInfo.InvariantCulture)); + Console.WriteLine(doubleNumber.ToString("F1", CultureInfo.InvariantCulture)); // Displays -1898300.2 - Console.WriteLine(doubleNumber.ToString("F3", + Console.WriteLine(doubleNumber.ToString("F3", CultureInfo.CreateSpecificCulture("es-ES"))); - // Displays -1898300,199 + // Displays -1898300,199 // } - + public static void ShowGeneral() { // double number; - - number = 12345.6789; + + number = 12345.6789; Console.WriteLine(number.ToString("G", CultureInfo.InvariantCulture)); // Displays 12345.6789 - Console.WriteLine(number.ToString("G", + Console.WriteLine(number.ToString("G", CultureInfo.CreateSpecificCulture("fr-FR"))); // Displays 12345,6789 - + Console.WriteLine(number.ToString("G7", CultureInfo.InvariantCulture)); - // Displays 12345.68 - + // Displays 12345.68 + number = .0000023; Console.WriteLine(number.ToString("G", CultureInfo.InvariantCulture)); - // Displays 2.3E-06 - Console.WriteLine(number.ToString("G", + // Displays 2.3E-06 + Console.WriteLine(number.ToString("G", CultureInfo.CreateSpecificCulture("fr-FR"))); // Displays 2,3E-06 - + number = .0023; Console.WriteLine(number.ToString("G", CultureInfo.InvariantCulture)); // Displays 0.0023 @@ -157,49 +157,49 @@ public static void ShowGeneral() number = Math.PI; Console.WriteLine(number.ToString("G5", CultureInfo.InvariantCulture)); - // Displays 3.1416 + // Displays 3.1416 // } - + public static void ShowNumeric() { // double dblValue = -12445.6789; Console.WriteLine(dblValue.ToString("N", CultureInfo.InvariantCulture)); // Displays -12,445.68 - Console.WriteLine(dblValue.ToString("N1", + Console.WriteLine(dblValue.ToString("N1", CultureInfo.CreateSpecificCulture("sv-SE"))); // Displays -12 445,7 - + int intValue = 123456789; Console.WriteLine(intValue.ToString("N1", CultureInfo.InvariantCulture)); - // Displays 123,456,789.0 + // Displays 123,456,789.0 // } - + public static void ShowPercent() { // double number = .2468013; Console.WriteLine(number.ToString("P", CultureInfo.InvariantCulture)); // Displays 24.68 % - Console.WriteLine(number.ToString("P", + Console.WriteLine(number.ToString("P", CultureInfo.CreateSpecificCulture("hr-HR"))); - // Displays 24,68% + // Displays 24,68% Console.WriteLine(number.ToString("P1", CultureInfo.InvariantCulture)); // Displays 24.7 % // } - + public static void ShowRoundTrip() { // double value; - + value = Math.PI; Console.WriteLine(value.ToString("r")); // Displays 3.1415926535897931 - Console.WriteLine(value.ToString("r", + Console.WriteLine(value.ToString("r", CultureInfo.CreateSpecificCulture("fr-FR"))); // Displays 3,1415926535897931 value = 1.623e-21; @@ -207,12 +207,12 @@ public static void ShowRoundTrip() // Displays 1.623E-21 // } - + public static void ShowHex() { // - int value; - + int value; + value = 0x2045e; Console.WriteLine(value.ToString("x")); // Displays 2045e @@ -220,7 +220,7 @@ public static void ShowHex() // Displays 2045E Console.WriteLine(value.ToString("X8")); // Displays 0002045E - + value = 123456789; Console.WriteLine(value.ToString("X")); // Displays 75BCD15 diff --git a/samples/snippets/csharp/VS_Snippets_CLR/Formatting.Numeric.Standard/cs/standardusage1.cs b/samples/snippets/csharp/VS_Snippets_CLR/Formatting.Numeric.Standard/cs/standardusage1.cs index 4c7ee2fac5ac1..104ed75a0a784 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/Formatting.Numeric.Standard/cs/standardusage1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/Formatting.Numeric.Standard/cs/standardusage1.cs @@ -35,7 +35,7 @@ private static void ShowCompositeWithAlignment() Console.WriteLine(" {0,-28:C2}{1,14:C2}", amounts[0], amounts[1]); // Displays: // Beginning Balance Ending Balance - // $16,305.32 $18,794.16 + // $16,305.32 $18,794.16 // } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/GCNotification/cs/Program.cs b/samples/snippets/csharp/VS_Snippets_CLR/GCNotification/cs/Program.cs index ae3fa59f20ec4..efa6fdc30777b 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/GCNotification/cs/Program.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/GCNotification/cs/Program.cs @@ -8,20 +8,20 @@ namespace GCNotify { class Program { - // Variable for continual checking in the + // Variable for continual checking in the // While loop in the WaitForFullGCProc method. static bool checkForNotify = false; - // Variable for suspending work + // Variable for suspending work // (such servicing allocated server requests) - // after a notification is received and then + // after a notification is received and then // resuming allocation after inducing a garbage collection. static bool bAllocate = false; // Variable for ending the example. static bool finalExit = false; - // Collection for objects that + // Collection for objects that // simulate the server request workload. static List load = new List(); @@ -29,7 +29,7 @@ public static void Main(string[] args) { try { - // Register for a notification. + // Register for a notification. GC.RegisterForFullGCNotification(10, 10); Console.WriteLine("Registered for GC notification."); @@ -60,7 +60,7 @@ public static void Main(string[] args) Console.WriteLine("Gen 2 collection count: {0}", GC.CollectionCount(2).ToString()); lastCollCount = newCollCount; } - + // For ending the example (arbitrary). if (newCollCount == 500) { @@ -96,12 +96,12 @@ public static void OnFullGCApproachNotify() Console.WriteLine("Redirecting requests."); - // Method that tells the request queuing - // server to not direct requests to this server. + // Method that tells the request queuing + // server to not direct requests to this server. RedirectRequests(); - // Method that provides time to - // finish processing pending requests. + // Method that provides time to + // finish processing pending requests. FinishExistingRequests(); // This is a good time to induce a GC collection @@ -148,9 +148,9 @@ public static void WaitForFullGCProc() else { // This can occur if a timeout period - // is specified for WaitForFullGCApproach(Timeout) - // or WaitForFullGCComplete(Timeout) - // and the time out period has elapsed. + // is specified for WaitForFullGCApproach(Timeout) + // or WaitForFullGCComplete(Timeout) + // and the time out period has elapsed. Console.WriteLine("GC Notification not applicable."); break; } @@ -179,7 +179,7 @@ public static void WaitForFullGCProc() } Thread.Sleep(500); - // FinalExit is set to true right before + // FinalExit is set to true right before // the main thread cancelled notification. if (finalExit) { diff --git a/samples/snippets/csharp/VS_Snippets_CLR/GenericMethodHowTo/CS/source.cs b/samples/snippets/csharp/VS_Snippets_CLR/GenericMethodHowTo/CS/source.cs index 7c6ef66171203..70af6c8409310 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/GenericMethodHowTo/CS/source.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/GenericMethodHowTo/CS/source.cs @@ -4,7 +4,7 @@ using System.Reflection; using System.Reflection.Emit; -// Declare a generic delegate that can be used to execute the +// Declare a generic delegate that can be used to execute the // finished method. // // @@ -19,12 +19,12 @@ class GenericMethodBuilder // (class), must have a parameterless constructor (new()), and must // implement ICollection. This interface constraint // ensures that ICollection.Add can be used to add - // elements to the TOutput object the method creates. The method - // has one formal parameter, input, which is an array of TInput. + // elements to the TOutput object the method creates. The method + // has one formal parameter, input, which is an array of TInput. // The elements of this array are copied to the new TOutput. // // - public static TOutput Factory(TInput[] tarray) + public static TOutput Factory(TInput[] tarray) where TOutput : class, ICollection, new() { TOutput ret = new TOutput(); @@ -42,14 +42,14 @@ public static void Main() { // The following shows the usage syntax of the C# // version of the generic method emitted by this program. - // Note that the generic parameters must be specified - // explicitly, because the compiler does not have enough + // Note that the generic parameters must be specified + // explicitly, because the compiler does not have enough // context to infer the type of TOutput. In this case, TOutput // is a generic List containing strings. - // + // // string[] arr = {"a", "b", "c", "d", "e"}; - List list1 = + List list1 = GenericMethodBuilder.Factory>(arr); Console.WriteLine("The first element is: {0}", list1[0]); // @@ -60,33 +60,33 @@ public static void Main() // AssemblyName asmName = new AssemblyName("DemoMethodBuilder1"); AppDomain domain = AppDomain.CurrentDomain; - AssemblyBuilder demoAssembly = - domain.DefineDynamicAssembly(asmName, + AssemblyBuilder demoAssembly = + domain.DefineDynamicAssembly(asmName, AssemblyBuilderAccess.RunAndSave); - // Define the module that contains the code. For an - // assembly with one module, the module name is the + // Define the module that contains the code. For an + // assembly with one module, the module name is the // assembly name plus a file extension. - ModuleBuilder demoModule = - demoAssembly.DefineDynamicModule(asmName.Name, + ModuleBuilder demoModule = + demoAssembly.DefineDynamicModule(asmName.Name, asmName.Name+".dll"); // - + // Define a type to contain the method. // - TypeBuilder demoType = + TypeBuilder demoType = demoModule.DefineType("DemoType", TypeAttributes.Public); // // Define a public static method with standard calling // conventions. Do not specify the parameter types or the - // return type, because type parameters will be used for + // return type, because type parameters will be used for // those types, and the type parameters have not been // defined yet. // // - MethodBuilder factory = - demoType.DefineMethod("Factory", + MethodBuilder factory = + demoType.DefineMethod("Factory", MethodAttributes.Public | MethodAttributes.Static); // @@ -96,7 +96,7 @@ public static void Main() // // string[] typeParameterNames = {"TInput", "TOutput"}; - GenericTypeParameterBuilder[] typeParameters = + GenericTypeParameterBuilder[] typeParameters = factory.DefineGenericParameters(typeParameterNames); GenericTypeParameterBuilder TInput = typeParameters[0]; @@ -107,10 +107,10 @@ public static void Main() // The type parameter TOutput is constrained to be a reference // type, and to have a parameterless constructor. This ensures // that the Factory method can create the collection type. - // + // // TOutput.SetGenericParameterAttributes( - GenericParameterAttributes.ReferenceTypeConstraint | + GenericParameterAttributes.ReferenceTypeConstraint | GenericParameterAttributes.DefaultConstructorConstraint); // @@ -119,7 +119,7 @@ public static void Main() // implement the ICollection interface, to ensure that // they have an Add method that can be used to add elements. // - // To create the constraint, first use MakeGenericType to bind + // To create the constraint, first use MakeGenericType to bind // the type parameter TInput to the ICollection interface, // returning the type ICollection, then pass // the newly created type to the SetInterfaceConstraints @@ -146,7 +146,7 @@ public static void Main() factory.SetReturnType(TOutput); // - // Generate a code body for the method. + // Generate a code body for the method. // ----------------------------------- // Get a code generator and declare local variables and // labels. Save the input array to a local variable. @@ -166,19 +166,19 @@ public static void Main() ilgen.Emit(OpCodes.Stloc_S, input); // - // Create an instance of TOutput, using the generic method - // overload of the Activator.CreateInstance method. + // Create an instance of TOutput, using the generic method + // overload of the Activator.CreateInstance method. // Using this overload requires the specified type to have - // a parameterless constructor, which is the reason for adding + // a parameterless constructor, which is the reason for adding // that constraint to TOutput. Create the constructed generic // method by passing TOutput to MakeGenericMethod. After // emitting code to call the method, emit code to store the - // new TOutput in a local variable. + // new TOutput in a local variable. // // - MethodInfo createInst = + MethodInfo createInst = typeof(Activator).GetMethod("CreateInstance", Type.EmptyTypes); - MethodInfo createInstOfTOutput = + MethodInfo createInstOfTOutput = createInst.MakeGenericMethod(TOutput); ilgen.Emit(OpCodes.Call, createInstOfTOutput); @@ -197,7 +197,7 @@ public static void Main() // Loop through the array, adding each element to the new // instance of TOutput. Note that in order to get a MethodInfo - // for ICollection.Add, it is necessary to first + // for ICollection.Add, it is necessary to first // get the Add method for the generic type defintion, // ICollection.Add. This is because it is not possible // to call GetMethod on icollOfTInput. The static overload of @@ -218,13 +218,13 @@ public static void Main() // Mark the beginning of the loop. Push the ICollection // reference on the stack, so it will be in position for the - // call to Add. Then push the array and the index on the + // call to Add. Then push the array and the index on the // stack, get the array element, and call Add (represented // by the MethodInfo mAdd) to add it to the collection. // // The other ten instructions just increment the index // and test for the end of the loop. Note the MarkLabel - // method, which sets the point in the code where the + // method, which sets the point in the code where the // loop is entered. (See the earlier Br_S to enterLoop.) // // @@ -263,24 +263,24 @@ public static void Main() // // To create a constructed generic method that can be - // executed, first call the GetMethod method on the completed + // executed, first call the GetMethod method on the completed // type to get the generic method definition. Call MakeGenericType // on the generic method definition to obtain the constructed // method, passing in the type arguments. In this case, the // constructed method has string for TInput and List - // for TOutput. + // for TOutput. // // MethodInfo m = dt.GetMethod("Factory"); - MethodInfo bound = + MethodInfo bound = m.MakeGenericMethod(typeof(string), typeof(List)); // Display a string representing the bound method. Console.WriteLine(bound); // - // Once the generic method is constructed, - // you can invoke it and pass in an array of objects + // Once the generic method is constructed, + // you can invoke it and pass in an array of objects // representing the arguments. In this case, there is only // one element in that array, the argument 'arr'. // @@ -292,14 +292,14 @@ public static void Main() // // You can get better performance from multiple calls if - // you bind the constructed method to a delegate. The - // following code uses the generic delegate D defined + // you bind the constructed method to a delegate. The + // following code uses the generic delegate D defined // earlier. // // Type dType = typeof(D>); D> test; - test = (D>) + test = (D>) Delegate.CreateDelegate(dType, bound); List list3 = test(arr); diff --git a/samples/snippets/csharp/VS_Snippets_CLR/HookUpDelegate/cs/source.cs b/samples/snippets/csharp/VS_Snippets_CLR/HookUpDelegate/cs/source.cs index 2ffe7c6ffcbf6..642bc4a6b9c7a 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/HookUpDelegate/cs/source.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/HookUpDelegate/cs/source.cs @@ -5,7 +5,7 @@ using System.Windows.Forms; // -class ExampleForm : Form +class ExampleForm : Form { public ExampleForm() : base() { @@ -31,11 +31,11 @@ private void HookUpDelegate() // Assembly assem = typeof(Example).Assembly; // - - // Get the type that is to be loaded, and create an instance + + // Get the type that is to be loaded, and create an instance // of it. Activator.CreateInstance has other overloads, if // the type lacks a default constructor. The new instance - // is stored as type Object, to maintain the fiction that + // is stored as type Object, to maintain the fiction that // nothing is known about the assembly. (Note that you can // get the types in an assembly without knowing their names // in advance.) @@ -54,11 +54,11 @@ private void HookUpDelegate() // // If you already have a method with the correct signature, - // you can simply get a MethodInfo for it. + // you can simply get a MethodInfo for it. // // - MethodInfo miHandler = - typeof(Example).GetMethod("LuckyHandler", + MethodInfo miHandler = + typeof(Example).GetMethod("LuckyHandler", BindingFlags.NonPublic | BindingFlags.Instance); // @@ -82,13 +82,13 @@ private void HookUpDelegate() // // Event handler methods can also be generated at run time, - // using lightweight dynamic methods and Reflection.Emit. + // using lightweight dynamic methods and Reflection.Emit. // To construct an event handler, you need the return type // and parameter types of the delegate. These can be obtained - // by examining the delegate's Invoke method. + // by examining the delegate's Invoke method. // - // It is not necessary to name dynamic methods, so the empty - // string can be used. The last argument associates the + // It is not necessary to name dynamic methods, so the empty + // string can be used. The last argument associates the // dynamic method with the current type, giving the delegate // access to all the public and private members of Example, // as if it were an instance method. @@ -97,16 +97,16 @@ private void HookUpDelegate() Type returnType = GetDelegateReturnType(tDelegate); if (returnType != typeof(void)) throw new ApplicationException("Delegate has a return type."); - - DynamicMethod handler = - new DynamicMethod("", + + DynamicMethod handler = + new DynamicMethod("", null, GetDelegateParameterTypes(tDelegate), typeof(Example)); // - // Generate a method body. This method loads a string, calls - // the Show method overload that takes a string, pops the + // Generate a method body. This method loads a string, calls + // the Show method overload that takes a string, pops the // return value off the stack (because the handler has no // return type), and returns. // @@ -114,10 +114,10 @@ private void HookUpDelegate() ILGenerator ilgen = handler.GetILGenerator(); Type[] showParameters = { typeof(String) }; - MethodInfo simpleShow = + MethodInfo simpleShow = typeof(MessageBox).GetMethod("Show", showParameters); - ilgen.Emit(OpCodes.Ldstr, + ilgen.Emit(OpCodes.Ldstr, "This event handler was constructed at run time."); ilgen.Emit(OpCodes.Call, simpleShow); ilgen.Emit(OpCodes.Pop); diff --git a/samples/snippets/csharp/VS_Snippets_CLR/HowToDecryptXMLElementX509/cs/sample.cs b/samples/snippets/csharp/VS_Snippets_CLR/HowToDecryptXMLElementX509/cs/sample.cs index 777986c5551c4..fad792ec0a88e 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/HowToDecryptXMLElementX509/cs/sample.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/HowToDecryptXMLElementX509/cs/sample.cs @@ -41,7 +41,7 @@ static void Main(string[] args) public static void Decrypt(XmlDocument Doc) { - // Check the arguments. + // Check the arguments. if (Doc == null) throw new ArgumentNullException("Doc"); diff --git a/samples/snippets/csharp/VS_Snippets_CLR/HowToEmitCodeInPartialTrust/cs/source.cs b/samples/snippets/csharp/VS_Snippets_CLR/HowToEmitCodeInPartialTrust/cs/source.cs index 90243032414d5..fd6039bd75a72 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/HowToEmitCodeInPartialTrust/cs/source.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/HowToEmitCodeInPartialTrust/cs/source.cs @@ -8,7 +8,7 @@ using System.Collections; using System.Diagnostics; -// This code example works properly only if it is run from a fully +// This code example works properly only if it is run from a fully // trusted location, such as your local computer. // Delegates used to execute the dynamic methods. @@ -17,7 +17,7 @@ public delegate void Test1(); public delegate char Test2(String instance); -// The Worker class must inherit MarshalByRefObject so that its public +// The Worker class must inherit MarshalByRefObject so that its public // methods can be invoked across application domain boundaries. // // @@ -45,18 +45,18 @@ public void SimpleEmitDemo() // // This overload of AccessPrivateMethod emits a dynamic method and - // specifies whether to skip JIT visiblity checks. It creates a - // delegate for the method and invokes the delegate. The dynamic + // specifies whether to skip JIT visiblity checks. It creates a + // delegate for the method and invokes the delegate. The dynamic // method calls a private method of the Worker class. - public void AccessPrivateMethod(bool restrictedSkipVisibility) + public void AccessPrivateMethod(bool restrictedSkipVisibility) { // Create an unnamed dynamic method that has no return type, // takes one parameter of type Worker, and optionally skips JIT // visiblity checks. DynamicMethod meth = new DynamicMethod( - "", - null, - new Type[] { typeof(Worker) }, + "", + null, + new Type[] { typeof(Worker) }, restrictedSkipVisibility); // Get a MethodInfo for the private method. @@ -72,37 +72,37 @@ public void AccessPrivateMethod(bool restrictedSkipVisibility) il.EmitCall(OpCodes.Call, pvtMeth, null); il.Emit(OpCodes.Ret); - // Create a delegate that represents the dynamic method, and - // invoke it. - try + // Create a delegate that represents the dynamic method, and + // invoke it. + try { Test t = (Test) meth.CreateDelegate(typeof(Test)); - try + try { t(this); } - catch (Exception ex) + catch (Exception ex) { - Console.WriteLine("{0} was thrown when the delegate was invoked.", + Console.WriteLine("{0} was thrown when the delegate was invoked.", ex.GetType().Name); } - } - catch (Exception ex) + } + catch (Exception ex) { - Console.WriteLine("{0} was thrown when the delegate was compiled.", + Console.WriteLine("{0} was thrown when the delegate was compiled.", ex.GetType().Name); } } // This overload of AccessPrivateMethod emits a dynamic method that takes - // a string and returns the first character, using a private field of the + // a string and returns the first character, using a private field of the // String class. The dynamic method skips JIT visiblity checks. - public void AccessPrivateMethod() + public void AccessPrivateMethod() { // DynamicMethod meth = new DynamicMethod("", - typeof(char), - new Type[] { typeof(String) }, + typeof(char), + new Type[] { typeof(String) }, true); // @@ -116,23 +116,23 @@ public void AccessPrivateMethod() ILGenerator il = meth.GetILGenerator(); // Load the first argument, which is the target string, onto the - // execution stack, call the 'get' accessor to put the result onto + // execution stack, call the 'get' accessor to put the result onto // the execution stack, and return. il.Emit(OpCodes.Ldarg_0); il.EmitCall(OpCodes.Call, pvtMeth, null); il.Emit(OpCodes.Ret); - // Create a delegate that represents the dynamic method, and - // invoke it. - try + // Create a delegate that represents the dynamic method, and + // invoke it. + try { Test2 t = (Test2) meth.CreateDelegate(typeof(Test2)); char first = t("Hello, World!"); Console.WriteLine("{0} is the first character.", first); - } - catch (Exception ex) + } + catch (Exception ex) { - Console.WriteLine("{0} was thrown when the delegate was compiled.", + Console.WriteLine("{0} was thrown when the delegate was compiled.", ex.GetType().Name); } } @@ -154,7 +154,7 @@ static void Main() PermissionSet pset = new NamedPermissionSet("Internet", SecurityManager.GetStandardSandbox(ev)); // - // For simplicity, set up the application domain to use the + // For simplicity, set up the application domain to use the // current path as the application folder, so the same executable // can be used in both trusted and untrusted scenarios. Normally // you would not do this with real untrusted code. @@ -163,15 +163,15 @@ static void Main() adSetup.ApplicationBase = "."; // - // Create an application domain in which all code that executes is + // Create an application domain in which all code that executes is // granted the permissions of an application run from the Internet. // AppDomain ad = AppDomain.CreateDomain("Sandbox", ev, adSetup, pset, null); // - // Create an instance of the Worker class in the partially trusted - // domain. Note: If you build this code example in Visual Studio, - // you must change the name of the class to include the default + // Create an instance of the Worker class in the partially trusted + // domain. Note: If you build this code example in Visual Studio, + // you must change the name of the class to include the default // namespace, which is the project name. For example, if the project // is "AnonymouslyHosted", the class is "AnonymouslyHosted.Worker". // @@ -184,7 +184,7 @@ static void Main() // // Emit and invoke a dynamic method that calls a private method - // of Worker, with JIT visibility checks enforced. The call fails + // of Worker, with JIT visibility checks enforced. The call fails // when the delegate is invoked. w.AccessPrivateMethod(false); @@ -195,9 +195,9 @@ static void Main() // Unload the application domain. Add RestrictedMemberAccess to the // grant set, and use it to create an application domain in which - // partially trusted code can call private members, as long as the - // trust level of those members is equal to or lower than the trust - // level of the partially trusted code. + // partially trusted code can call private members, as long as the + // trust level of those members is equal to or lower than the trust + // level of the partially trusted code. AppDomain.Unload(ad); // pset.SetPermission( @@ -208,16 +208,16 @@ static void Main() ad = AppDomain.CreateDomain("Sandbox2", ev, adSetup, pset, null); // - // Create an instance of the Worker class in the partially trusted - // domain. + // Create an instance of the Worker class in the partially trusted + // domain. w = (Worker) ad.CreateInstanceAndUnwrap(asmName, "Worker"); // Again, emit and invoke a dynamic method that calls a private method - // of Worker, skipping JIT visibility checks. This time compilation + // of Worker, skipping JIT visibility checks. This time compilation // succeeds because of the grant for RestrictedMemberAccess. w.AccessPrivateMethod(true); - // Finally, emit and invoke a dynamic method that calls an internal + // Finally, emit and invoke a dynamic method that calls an internal // method of the String class. The call fails, because the trust level // of the assembly that contains String is higher than the trust level // of the assembly that emits the dynamic method. diff --git a/samples/snippets/csharp/VS_Snippets_CLR/HowToEncryptXMLElementAsymmetric/cs/sample.cs b/samples/snippets/csharp/VS_Snippets_CLR/HowToEncryptXMLElementAsymmetric/cs/sample.cs index c93e1d4876166..5ac10bbfb53fc 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/HowToEncryptXMLElementAsymmetric/cs/sample.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/HowToEncryptXMLElementAsymmetric/cs/sample.cs @@ -213,7 +213,7 @@ public static void Encrypt(XmlDocument Doc, string ElementToEncrypt, string Encr public static void Decrypt(XmlDocument Doc, RSA Alg, string KeyName) { - // Check the arguments. + // Check the arguments. if (Doc == null) throw new ArgumentNullException("Doc"); if (Alg == null) diff --git a/samples/snippets/csharp/VS_Snippets_CLR/HowToEncryptXMLElementSymmetric/cs/sample.cs b/samples/snippets/csharp/VS_Snippets_CLR/HowToEncryptXMLElementSymmetric/cs/sample.cs index 3efc4c6e540d1..650654e50690d 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/HowToEncryptXMLElementSymmetric/cs/sample.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/HowToEncryptXMLElementSymmetric/cs/sample.cs @@ -54,7 +54,7 @@ static void Main(string[] args) public static void Encrypt(XmlDocument Doc, string ElementName, SymmetricAlgorithm Key) { - // Check the arguments. + // Check the arguments. if (Doc == null) throw new ArgumentNullException("Doc"); if (ElementName == null) @@ -76,8 +76,8 @@ public static void Encrypt(XmlDocument Doc, string ElementName, SymmetricAlgorit } ////////////////////////////////////////////////// - // Create a new instance of the EncryptedXml class - // and use it to encrypt the XmlElement with the + // Create a new instance of the EncryptedXml class + // and use it to encrypt the XmlElement with the // symmetric key. ////////////////////////////////////////////////// @@ -96,7 +96,7 @@ public static void Encrypt(XmlDocument Doc, string ElementName, SymmetricAlgorit edElement.Type = EncryptedXml.XmlEncElementUrl; // - // Create an EncryptionMethod element so that the + // Create an EncryptionMethod element so that the // receiver knows which algorithm to use for decryption. // Determine what kind of algorithm is being used and // supply the appropriate URL to the EncryptionMethod element. @@ -136,7 +136,7 @@ public static void Encrypt(XmlDocument Doc, string ElementName, SymmetricAlgorit edElement.EncryptionMethod = new EncryptionMethod(encryptionMethod); // - // Add the encrypted element data to the + // Add the encrypted element data to the // EncryptedData object. // edElement.CipherData.CipherValue = encryptedElement; @@ -153,7 +153,7 @@ public static void Encrypt(XmlDocument Doc, string ElementName, SymmetricAlgorit public static void Decrypt(XmlDocument Doc, SymmetricAlgorithm Alg) { - // Check the arguments. + // Check the arguments. if (Doc == null) throw new ArgumentNullException("Doc"); if (Alg == null) diff --git a/samples/snippets/csharp/VS_Snippets_CLR/HowToEncryptXMLElementX509/cs/sample.cs b/samples/snippets/csharp/VS_Snippets_CLR/HowToEncryptXMLElementX509/cs/sample.cs index b9ba0cb38acd8..ff23e90e02e70 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/HowToEncryptXMLElementX509/cs/sample.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/HowToEncryptXMLElementX509/cs/sample.cs @@ -19,7 +19,7 @@ static void Main(string[] args) // Load an XML file into the XmlDocument object. xmlDoc.PreserveWhitespace = true; xmlDoc.Load("test.xml"); - + // Open the X.509 "Current User" store in read only mode. // X509Store store = new X509Store(StoreLocation.CurrentUser); @@ -36,7 +36,7 @@ static void Main(string[] args) // X509Certificate2 cert = null; - // Loop through each certificate and find the certificate + // Loop through each certificate and find the certificate // with the appropriate name. foreach (X509Certificate2 c in certCollection) { @@ -80,7 +80,7 @@ static void Main(string[] args) public static void Encrypt(XmlDocument Doc, string ElementToEncrypt, X509Certificate2 Cert) { - // Check the arguments. + // Check the arguments. if (Doc == null) throw new ArgumentNullException("Doc"); if (ElementToEncrypt == null) @@ -103,8 +103,8 @@ public static void Encrypt(XmlDocument Doc, string ElementToEncrypt, X509Certifi } ////////////////////////////////////////////////// - // Create a new instance of the EncryptedXml class - // and use it to encrypt the XmlElement with the + // Create a new instance of the EncryptedXml class + // and use it to encrypt the XmlElement with the // X.509 Certificate. ////////////////////////////////////////////////// diff --git a/samples/snippets/csharp/VS_Snippets_CLR/HowToGeneric/CS/source2.cs b/samples/snippets/csharp/VS_Snippets_CLR/HowToGeneric/CS/source2.cs index 18f3e78ecf741..657eba7435746 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/HowToGeneric/CS/source2.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/HowToGeneric/CS/source2.cs @@ -26,7 +26,7 @@ public static void Main() int index0 = Array.BinarySearch(myArray, "test string"); int index1 = Array.BinarySearch(myArray, "test string"); // - + Console.WriteLine("Indexes for binary searches: {0}, {1}", index0, index1); } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/HowToGeneric/CS/ur.cs b/samples/snippets/csharp/VS_Snippets_CLR/HowToGeneric/CS/ur.cs index 9d339e835b0d6..545113dcbdacb 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/HowToGeneric/CS/ur.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/HowToGeneric/CS/ur.cs @@ -44,7 +44,7 @@ private static void DisplayGenericType(Type t) // // - Console.WriteLine(" List {0} type arguments:", + Console.WriteLine(" List {0} type arguments:", typeParameters.Length); foreach( Type tParam in typeParameters ) { @@ -67,7 +67,7 @@ private static void DisplayGenericType(Type t) // private static void DisplayGenericParameter(Type tp) { - Console.WriteLine(" Type parameter: {0} position {1}", + Console.WriteLine(" Type parameter: {0} position {1}", tp.Name, tp.GenericParameterPosition); // @@ -85,7 +85,7 @@ private static void DisplayGenericParameter(Type tp) if (classConstraint != null) { - Console.WriteLine(" Base type constraint: {0}", + Console.WriteLine(" Base type constraint: {0}", tp.BaseType); } else @@ -95,8 +95,8 @@ private static void DisplayGenericParameter(Type tp) // // - GenericParameterAttributes sConstraints = - tp.GenericParameterAttributes & + GenericParameterAttributes sConstraints = + tp.GenericParameterAttributes & GenericParameterAttributes.SpecialConstraintMask; // @@ -130,10 +130,10 @@ private static void DisplayGenericParameter(Type tp) public static void Main() { // Two ways to get a Type object that represents the generic - // type definition of the Dictionary class. + // type definition of the Dictionary class. // // - // Use the typeof operator to create the generic type + // Use the typeof operator to create the generic type // definition directly. To specify the generic type definition, // omit the type arguments but retain the comma that separates // them. @@ -146,7 +146,7 @@ public static void Main() // is a dictionary of Example objects, with String keys. Dictionary d2 = new Dictionary(); // Get a Type object that represents the constructed type, - // and from that get the generic type definition. The + // and from that get the generic type definition. The // variables d1 and d4 contain the same type. Type d3 = d2.GetType(); Type d4 = d3.GetGenericTypeDefinition(); @@ -157,10 +157,10 @@ public static void Main() DisplayGenericType(d1); DisplayGenericType(d2.GetType()); - // Construct an array of type arguments to substitute for + // Construct an array of type arguments to substitute for // the type parameters of the generic Dictionary class. - // The array must contain the correct number of types, in - // the same order that they appear in the type parameter + // The array must contain the correct number of types, in + // the same order that they appear in the type parameter // list of Dictionary. The key (first type parameter) // is of type string, and the type to be contained in the // dictionary is Example. @@ -185,8 +185,8 @@ public static void Main() Console.WriteLine(" Are the generic definitions equal? {0}", (d1==constructed.GetGenericTypeDefinition())); - // Demonstrate the DisplayGenericType and - // DisplayGenericParameter methods with the Test class + // Demonstrate the DisplayGenericType and + // DisplayGenericParameter methods with the Test class // defined above. This shows base, interface, and special // constraints. DisplayGenericType(typeof(Test<>)); diff --git a/samples/snippets/csharp/VS_Snippets_CLR/HowToSignXMLDocumentRSA/cs/sample.cs b/samples/snippets/csharp/VS_Snippets_CLR/HowToSignXMLDocumentRSA/cs/sample.cs index 6a4b0bc363315..d87438cfa5401 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/HowToSignXMLDocumentRSA/cs/sample.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/HowToSignXMLDocumentRSA/cs/sample.cs @@ -17,7 +17,7 @@ public static void Main(String[] args) cspParams.KeyContainerName = "XML_DSIG_RSA_KEY"; // - // Create a new RSA signing key and save it in the container. + // Create a new RSA signing key and save it in the container. // RSACryptoServiceProvider rsaKey = new RSACryptoServiceProvider(cspParams); // @@ -31,7 +31,7 @@ public static void Main(String[] args) xmlDoc.Load("test.xml"); // - // Sign the XML document. + // Sign the XML document. SignXml(xmlDoc, rsaKey); Console.WriteLine("XML file signed."); @@ -47,8 +47,8 @@ public static void Main(String[] args) } } - // Sign an XML file. - // This document cannot be verified unless the verifying + // Sign an XML file. + // This document cannot be verified unless the verifying // code has the key with which it was signed. public static void SignXml(XmlDocument xmlDoc, RSA rsaKey) { diff --git a/samples/snippets/csharp/VS_Snippets_CLR/HowToVerifyXMLDocumentRSA/cs/sample.cs b/samples/snippets/csharp/VS_Snippets_CLR/HowToVerifyXMLDocumentRSA/cs/sample.cs index 250f17e510dd6..73d2616ab7fa3 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/HowToVerifyXMLDocumentRSA/cs/sample.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/HowToVerifyXMLDocumentRSA/cs/sample.cs @@ -18,7 +18,7 @@ public static void Main(String[] args) cspParams.KeyContainerName = "XML_DSIG_RSA_KEY"; // - // Create a new RSA signing key and save it in the container. + // Create a new RSA signing key and save it in the container. // RSACryptoServiceProvider rsaKey = new RSACryptoServiceProvider(cspParams); // @@ -36,7 +36,7 @@ public static void Main(String[] args) Console.WriteLine("Verifying signature..."); bool result = VerifyXml(xmlDoc, rsaKey); - // Display the results of the signature verification to + // Display the results of the signature verification to // the console. if (result) { @@ -53,7 +53,7 @@ public static void Main(String[] args) } } - // Verify the signature of an XML file against an asymmetric + // Verify the signature of an XML file against an asymmetric // algorithm and return the result. public static Boolean VerifyXml(XmlDocument xmlDoc, RSA key) { @@ -82,14 +82,14 @@ public static Boolean VerifyXml(XmlDocument xmlDoc, RSA key) } // This example only supports one signature for - // the entire XML document. Throw an exception + // the entire XML document. Throw an exception // if more than one signature was found. if (nodeList.Count >= 2) { throw new CryptographicException("Verification failed: More that one signature was found for the document."); } - // Load the first node. + // Load the first node. // signedXml.LoadXml((XmlElement)nodeList[0]); // diff --git a/samples/snippets/csharp/VS_Snippets_CLR/IO.Compression.GZip1/CS/gziptest.cs b/samples/snippets/csharp/VS_Snippets_CLR/IO.Compression.GZip1/CS/gziptest.cs index 837456bfca866..9868e18721c35 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/IO.Compression.GZip1/CS/gziptest.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/IO.Compression.GZip1/CS/gziptest.cs @@ -23,12 +23,12 @@ public static void Compress(DirectoryInfo directorySelected) { using (FileStream originalFileStream = fileToCompress.OpenRead()) { - if ((File.GetAttributes(fileToCompress.FullName) & + if ((File.GetAttributes(fileToCompress.FullName) & FileAttributes.Hidden) != FileAttributes.Hidden & fileToCompress.Extension != ".gz") { using (FileStream compressedFileStream = File.Create(fileToCompress.FullName + ".gz")) { - using (GZipStream compressionStream = new GZipStream(compressedFileStream, + using (GZipStream compressionStream = new GZipStream(compressedFileStream, CompressionMode.Compress)) { originalFileStream.CopyTo(compressionStream); diff --git a/samples/snippets/csharp/VS_Snippets_CLR/RegularExpressions.Classes/cs/Example.cs b/samples/snippets/csharp/VS_Snippets_CLR/RegularExpressions.Classes/cs/Example.cs index 49cec516f4373..5b044e6c6c257 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/RegularExpressions.Classes/cs/Example.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/RegularExpressions.Classes/cs/Example.cs @@ -26,9 +26,9 @@ private static void InstantiateRegex() { // // Declare object variable of type Regex. - Regex r; + Regex r; // Create a Regex object and define its regular expression. - r = new Regex(@"\s2000"); + r = new Regex(@"\s2000"); // } @@ -36,16 +36,16 @@ private static void UseMatch() { // // Create a new Regex object. - var r = new Regex("abc"); + var r = new Regex("abc"); // Find a single match in the string. - Match m = r.Match("123abc456"); - if (m.Success) + Match m = r.Match("123abc456"); + if (m.Success) { - // Print out the character position where a match was found. + // Print out the character position where a match was found. Console.WriteLine("Found match at position " + m.Index); } // The example displays the following output: - // Found match at position 3 + // Found match at position 3 // } @@ -60,14 +60,14 @@ private static void UseMatchCollection() var r = new Regex("abc"); // Use the Matches method to find all matches in the input string. mc = r.Matches("123abc4abcd"); - // Loop through the match collection to retrieve all + // Loop through the match collection to retrieve all // matches and positions. - for (int i = 0; i < mc.Count; i++) + for (int i = 0; i < mc.Count; i++) { // Add the match string to the string array. results.Add(mc[i].Value); // Record the character position where the match was found. - matchposition.Add(mc[i].Index); + matchposition.Add(mc[i].Index); } // List the results. for (int ctr = 0; ctr <= results.Count - 1; ctr++) @@ -83,7 +83,7 @@ private static void UseGroupCollection() { // // Define groups "abc", "ab", and "b". - var r = new Regex("(a(b))c"); + var r = new Regex("(a(b))c"); Match m = r.Match("abdabc"); Console.WriteLine("Number of groups found = " + m.Groups.Count); // The example displays the following output: @@ -100,9 +100,9 @@ private static void UseCaptureCollection() GroupCollection gc; // Look for groupings of "Abc". - var r = new Regex("(Abc)+"); + var r = new Regex("(Abc)+"); // Define the string to search. - m = r.Match("XYZAbcAbcAbcXYZAbcAb"); + m = r.Match("XYZAbcAbcAbcXYZAbcAb"); gc = m.Groups; // Display the number of groups. @@ -118,10 +118,10 @@ private static void UseCaptureCollection() Console.WriteLine("Captures count = " + counter.ToString()); // Loop through each capture in the group. - for (int ii = 0; ii < counter; ii++) + for (int ii = 0; ii < counter; ii++) { // Display the capture and its position. - Console.WriteLine(cc[ii] + " Starts at character " + + Console.WriteLine(cc[ii] + " Starts at character " + cc[ii].Index); } } @@ -142,9 +142,9 @@ private static void UseGroup() var matchposition = new List(); var results = new List(); // Define substrings abc, ab, b. - var r = new Regex("(a(b))c"); + var r = new Regex("(a(b))c"); Match m = r.Match("abdabc"); - for (int i = 0; m.Groups[i].Value != ""; i++) + for (int i = 0; m.Groups[i].Value != ""; i++) { // Add groups to string array. results.Add(m.Groups[i].Value); @@ -154,7 +154,7 @@ private static void UseGroup() // Display the capture groups. for (int ctr = 0; ctr < results.Count; ctr++) - Console.WriteLine("{0} at position {1}", + Console.WriteLine("{0} at position {1}", results[ctr], matchposition[ctr]); // The example displays the following output: // abc at position 3 @@ -173,18 +173,18 @@ private static void UseCapture() r = new Regex("(abc)+"); m = r.Match("bcabcabc"); - for (int i = 0; m.Groups[i].Value != ""; i++) + for (int i = 0; m.Groups[i].Value != ""; i++) { Console.WriteLine(m.Groups[i].Value); // Capture the Collection for Group(i). - cc = m.Groups[i].Captures; + cc = m.Groups[i].Captures; for (int j = 0; j < cc.Count; j++) { Console.WriteLine($" Capture at position {cc[j].Index} for {cc[j].Length} characters."); // Position of Capture object. - posn = cc[j].Index; + posn = cc[j].Index; // Length of Capture object. - length = cc[j].Length; + length = cc[j].Length; } } // The example displays the following output: diff --git a/samples/snippets/csharp/VS_Snippets_CLR/RegularExpressions.Examples.ChangeDateFormats/cs/Example_ChangeDateFormats1.cs b/samples/snippets/csharp/VS_Snippets_CLR/RegularExpressions.Examples.ChangeDateFormats/cs/Example_ChangeDateFormats1.cs index 77389dfdd4ac2..b967cb993e35f 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/RegularExpressions.Examples.ChangeDateFormats/cs/Example_ChangeDateFormats1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/RegularExpressions.Examples.ChangeDateFormats/cs/Example_ChangeDateFormats1.cs @@ -7,21 +7,21 @@ public class Class1 { public static void Main() { - string dateString = DateTime.Today.ToString("d", + string dateString = DateTime.Today.ToString("d", DateTimeFormatInfo.InvariantInfo); string resultString = MDYToDMY(dateString); Console.WriteLine("Converted {0} to {1}.", dateString, resultString); } // - static string MDYToDMY(string input) + static string MDYToDMY(string input) { try { - return Regex.Replace(input, + return Regex.Replace(input, @"\b(?\d{1,2})/(?\d{1,2})/(?\d{2,4})\b", "${day}-${month}-${year}", RegexOptions.None, TimeSpan.FromMilliseconds(150)); - } + } catch (RegexMatchTimeoutException) { return input; } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/RegularExpressions.Examples.Email/cs/Example.cs b/samples/snippets/csharp/VS_Snippets_CLR/RegularExpressions.Examples.Email/cs/Example.cs index 3fae98f2ac923..543b22c0329b1 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/RegularExpressions.Examples.Email/cs/Example.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/RegularExpressions.Examples.Email/cs/Example.cs @@ -7,8 +7,8 @@ public class RegexUtilities public static bool IsValidEmail(string strIn) { // Return true if strIn is in valid email format. - return Regex.IsMatch(strIn, - @"^([0-9a-zA-Z]([-\.\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})$"); + return Regex.IsMatch(strIn, + @"^([0-9a-zA-Z]([-\.\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})$"); } } // @@ -18,8 +18,8 @@ public class Application { public static void Main() { - string[] emailAddresses = { "david.jones@proseware.com", "d.j@server1.proseware.com", - "jones@ms1.proseware.com", "j.@server1.proseware.com", + string[] emailAddresses = { "david.jones@proseware.com", "d.j@server1.proseware.com", + "jones@ms1.proseware.com", "j.@server1.proseware.com", "j@proseware.com9" }; foreach (string emailAddress in emailAddresses) { @@ -27,7 +27,7 @@ public static void Main() Console.WriteLine("Valid: {0}", emailAddress); else Console.WriteLine("Invalid: {0}", emailAddress); - } + } } } // The example displays the following output: diff --git a/samples/snippets/csharp/VS_Snippets_CLR/RegularExpressions.Examples.Email/cs/example2.cs b/samples/snippets/csharp/VS_Snippets_CLR/RegularExpressions.Examples.Email/cs/example2.cs index 0d8ea0219750e..43f93a17979be 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/RegularExpressions.Examples.Email/cs/example2.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/RegularExpressions.Examples.Email/cs/example2.cs @@ -7,9 +7,9 @@ public class RegexUtilities public static bool IsValidEmail(string strIn) { // Return true if strIn is in valid email format. - return Regex.IsMatch(strIn, - @"^(?("")(""[^""]+?""@)|(([0-9a-zA-Z]((\.(?!\.))|[-!#\$%&'\*\+/=\?\^`\{\}\|~\w])*)(?<=[0-9a-zA-Z])@))" + - @"(?(\[)(\[(\d{1,3}\.){3}\d{1,3}\])|(([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,6}))$"); + return Regex.IsMatch(strIn, + @"^(?("")(""[^""]+?""@)|(([0-9a-zA-Z]((\.(?!\.))|[-!#\$%&'\*\+/=\?\^`\{\}\|~\w])*)(?<=[0-9a-zA-Z])@))" + + @"(?(\[)(\[(\d{1,3}\.){3}\d{1,3}\])|(([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,6}))$"); } } // @@ -19,11 +19,11 @@ public class Application { public static void Main() { - string[] emailAddresses = { "david.jones@proseware.com", "d.j@server1.proseware.com", - "jones@ms1.proseware.com", "j.@server1.proseware.com", - "j@proseware.com9", "js#internal@proseware.com", - "j_9@[129.126.118.1]", "j..s@proseware.com", - "js*@proseware.com", "js@proseware..com", + string[] emailAddresses = { "david.jones@proseware.com", "d.j@server1.proseware.com", + "jones@ms1.proseware.com", "j.@server1.proseware.com", + "j@proseware.com9", "js#internal@proseware.com", + "j_9@[129.126.118.1]", "j..s@proseware.com", + "js*@proseware.com", "js@proseware..com", "js@proseware.com9", "j.s@server1.proseware.com" }; foreach (string emailAddress in emailAddresses) { @@ -31,7 +31,7 @@ public static void Main() Console.WriteLine("Valid: {0}", emailAddress); else Console.WriteLine("Invalid: {0}", emailAddress); - } + } } } // The example displays the following output: diff --git a/samples/snippets/csharp/VS_Snippets_CLR/RegularExpressions.Examples.Email/cs/example3.cs b/samples/snippets/csharp/VS_Snippets_CLR/RegularExpressions.Examples.Email/cs/example3.cs index 0dc87a8a682f1..ee041c1e92b21 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/RegularExpressions.Examples.Email/cs/example3.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/RegularExpressions.Examples.Email/cs/example3.cs @@ -6,13 +6,13 @@ public class RegexUtilities { bool invalid = false; - + public bool IsValidEmail(string strIn) { invalid = false; if (String.IsNullOrEmpty(strIn)) return false; - + // Use IdnMapping class to convert Unicode domain names. try { strIn = Regex.Replace(strIn, @"(@)(.+)$", this.DomainMapper, @@ -21,22 +21,22 @@ public bool IsValidEmail(string strIn) catch (RegexMatchTimeoutException) { return false; } - - if (invalid) + + if (invalid) return false; - + // Return true if strIn is in valid email format. try { - return Regex.IsMatch(strIn, - @"^(?("")(""[^""]+?""@)|(([0-9a-z]((\.(?!\.))|[-!#\$%&'\*\+/=\?\^`\{\}\|~\w])*)(?<=[0-9a-z])@))" + - @"(?(\[)(\[(\d{1,3}\.){3}\d{1,3}\])|(([0-9a-z][-\w]*[0-9a-z]*\.)+[a-z0-9]{2,24}))$", + return Regex.IsMatch(strIn, + @"^(?("")(""[^""]+?""@)|(([0-9a-z]((\.(?!\.))|[-!#\$%&'\*\+/=\?\^`\{\}\|~\w])*)(?<=[0-9a-z])@))" + + @"(?(\[)(\[(\d{1,3}\.){3}\d{1,3}\])|(([0-9a-z][-\w]*[0-9a-z]*\.)+[a-z0-9]{2,24}))$", RegexOptions.IgnoreCase, TimeSpan.FromMilliseconds(250)); - } + } catch (RegexMatchTimeoutException) { return false; } } - + private string DomainMapper(Match match) { // IdnMapping class with default property values. @@ -47,8 +47,8 @@ private string DomainMapper(Match match) domainName = idn.GetAscii(domainName); } catch (ArgumentException) { - invalid = true; - } + invalid = true; + } return match.Groups[1].Value + domainName; } } @@ -60,11 +60,11 @@ public class Application public static void Main() { RegexUtilities util = new RegexUtilities(); - string[] emailAddresses = { "david.jones@proseware.com", "d.j@server1.proseware.com", - "jones@ms1.proseware.com", "j.@server1.proseware.com", - "j@proseware.com9", "js#internal@proseware.com", - "j_9@[129.126.118.1]", "j..s@proseware.com", - "js*@proseware.com", "js@proseware..com", + string[] emailAddresses = { "david.jones@proseware.com", "d.j@server1.proseware.com", + "jones@ms1.proseware.com", "j.@server1.proseware.com", + "j@proseware.com9", "js#internal@proseware.com", + "j_9@[129.126.118.1]", "j..s@proseware.com", + "js*@proseware.com", "js@proseware..com", "js@proseware.com9", "j.s@server1.proseware.com" }; foreach (var emailAddress in emailAddresses) { @@ -72,7 +72,7 @@ public static void Main() Console.WriteLine("Valid: {0}", emailAddress); else Console.WriteLine("Invalid: {0}", emailAddress); - } + } } } // The example displays the following output: diff --git a/samples/snippets/csharp/VS_Snippets_CLR/RegularExpressions.Examples.HREF/cs/example.cs b/samples/snippets/csharp/VS_Snippets_CLR/RegularExpressions.Examples.HREF/cs/example.cs index f01497c13518d..04d8c6c014918 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/RegularExpressions.Examples.HREF/cs/example.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/RegularExpressions.Examples.HREF/cs/example.cs @@ -21,21 +21,21 @@ public static void Main() // Found href http://www.microsoft.com at 102 // Found href http://blogs.msdn.com/bclteam at 176 // - + // - private static void DumpHRefs(string inputString) + private static void DumpHRefs(string inputString) { Match m; string HRefPattern = @"href\s*=\s*(?:[""'](?<1>[^""']*)[""']|(?<1>\S+))"; - + try { - m = Regex.Match(inputString, HRefPattern, - RegexOptions.IgnoreCase | RegexOptions.Compiled, + m = Regex.Match(inputString, HRefPattern, + RegexOptions.IgnoreCase | RegexOptions.Compiled, TimeSpan.FromSeconds(1)); while (m.Success) { - Console.WriteLine("Found href " + m.Groups[1] + " at " + Console.WriteLine("Found href " + m.Groups[1] + " at " + m.Groups[1].Index); m = m.NextMatch(); } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/RegularExpressions.Examples.Protocol/cs/Example.cs b/samples/snippets/csharp/VS_Snippets_CLR/RegularExpressions.Examples.Protocol/cs/Example.cs index 2dcc7e9ce379c..65df938884e0a 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/RegularExpressions.Examples.Protocol/cs/Example.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/RegularExpressions.Examples.Protocol/cs/Example.cs @@ -12,9 +12,9 @@ public static void Main() RegexOptions.None, TimeSpan.FromMilliseconds(150)); Match m = r.Match(url); if (m.Success) - Console.WriteLine(m.Result("${proto}${port}")); + Console.WriteLine(m.Result("${proto}${port}")); } } // The example displays the following output: // http:8080 -// +// diff --git a/samples/snippets/csharp/VS_Snippets_CLR/RegularExpressions.Examples.Protocol/cs/example2.cs b/samples/snippets/csharp/VS_Snippets_CLR/RegularExpressions.Examples.Protocol/cs/example2.cs index 1d77d8becf872..80ff0c5b8b83f 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/RegularExpressions.Examples.Protocol/cs/example2.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/RegularExpressions.Examples.Protocol/cs/example2.cs @@ -12,7 +12,7 @@ public static void Main() Match m = r.Match(url); if (m.Success) // - Console.WriteLine(m.Groups["proto"].Value + m.Groups["port"].Value); + Console.WriteLine(m.Groups["proto"].Value + m.Groups["port"].Value); // } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/RegularExpressions.Examples.StripChars/cs/Example.cs b/samples/snippets/csharp/VS_Snippets_CLR/RegularExpressions.Examples.StripChars/cs/Example.cs index bb55a7aec0036..ecedeec59d8d7 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/RegularExpressions.Examples.StripChars/cs/Example.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/RegularExpressions.Examples.StripChars/cs/Example.cs @@ -8,13 +8,13 @@ static string CleanInput(string strIn) { // Replace invalid characters with empty strings. try { - return Regex.Replace(strIn, @"[^\w\.@-]", "", - RegexOptions.None, TimeSpan.FromSeconds(1.5)); + return Regex.Replace(strIn, @"[^\w\.@-]", "", + RegexOptions.None, TimeSpan.FromSeconds(1.5)); } - // If we timeout when replacing invalid characters, + // If we timeout when replacing invalid characters, // we should return Empty. catch (RegexMatchTimeoutException) { - return String.Empty; + return String.Empty; } } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/RegularExpressions.Quantifiers/cs/Quantifiers1.cs b/samples/snippets/csharp/VS_Snippets_CLR/RegularExpressions.Quantifiers/cs/Quantifiers1.cs index a7298d221140c..6e34656012ee7 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/RegularExpressions.Quantifiers/cs/Quantifiers1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/RegularExpressions.Quantifiers/cs/Quantifiers1.cs @@ -23,16 +23,16 @@ public static void Main() Console.WriteLine(); Console.WriteLine("{n,m} quantifier:"); ShowNM(); - Console.WriteLine(); + Console.WriteLine(); Console.WriteLine("*? quantifier:"); ShowLazyStar(); - Console.WriteLine(); + Console.WriteLine(); Console.WriteLine("+? quantifier:"); ShowLazyPlus(); - Console.WriteLine(); + Console.WriteLine(); Console.WriteLine("?? quantifier:"); ShowLazyQuestion(); - Console.WriteLine(); + Console.WriteLine(); Console.WriteLine("{n}? quantifier:"); ShowLazyN(); Console.WriteLine(); @@ -46,12 +46,12 @@ public static void Main() private static void ShowStar() { // - string pattern = @"\b91*9*\b"; + string pattern = @"\b91*9*\b"; string input = "99 95 919 929 9119 9219 999 9919 91119"; foreach (Match match in Regex.Matches(input, pattern)) Console.WriteLine("'{0}' found at position {1}.", match.Value, match.Index); - - // The example displays the following output: + + // The example displays the following output: // '99' found at position 0. // '919' found at position 6. // '9119' found at position 14. @@ -59,24 +59,24 @@ private static void ShowStar() // '91119' found at position 33. // } - + private static void ShowPlus() { // string pattern = @"\ban+\w*?\b"; - + string input = "Autumn is a great time for an annual announcement to all antique collectors."; foreach (Match match in Regex.Matches(input, pattern, RegexOptions.IgnoreCase)) Console.WriteLine("'{0}' found at position {1}.", match.Value, match.Index); - - // The example displays the following output: + + // The example displays the following output: // 'an' found at position 27. // 'annual' found at position 30. // 'announcement' found at position 37. - // 'antique' found at position 57. + // 'antique' found at position 57. // } - + private static void ShowQuestion() { // @@ -84,44 +84,44 @@ private static void ShowQuestion() string input = "An amiable animal with a large snount and an animated nose."; foreach (Match match in Regex.Matches(input, pattern, RegexOptions.IgnoreCase)) Console.WriteLine("'{0}' found at position {1}.", match.Value, match.Index); - - // The example displays the following output: + + // The example displays the following output: // 'An' found at position 0. // 'a' found at position 23. // 'an' found at position 42. // } - + private static void ShowN() { // string pattern = @"\b\d+\,\d{3}\b"; - string input = "Sales totaled 103,524 million in January, " + - "106,971 million in February, but only " + + string input = "Sales totaled 103,524 million in January, " + + "106,971 million in February, but only " + "943 million in March."; foreach (Match match in Regex.Matches(input, pattern)) Console.WriteLine("'{0}' found at position {1}.", match.Value, match.Index); - - // The example displays the following output: + + // The example displays the following output: // '103,524' found at position 14. // '106,971' found at position 45. // } - + private static void ShowNComma() { // - string pattern = @"\b\d{2,}\b\D+"; + string pattern = @"\b\d{2,}\b\D+"; string input = "7 days, 10 weeks, 300 years"; foreach (Match match in Regex.Matches(input, pattern)) Console.WriteLine("'{0}' found at position {1}.", match.Value, match.Index); - + // The example displays the following output: // '10 weeks, ' found at position 8. // '300 years' found at position 18. // } - + private static void ShowNM() { // @@ -129,14 +129,14 @@ private static void ShowNM() string input = "0x00 FF 00 00 18 17 FF 00 00 00 21 00 00 00 00 00"; foreach (Match match in Regex.Matches(input, pattern)) Console.WriteLine("'{0}' found at position {1}.", match.Value, match.Index); - + // The example displays the following output: // '00 00 ' found at position 8. // '00 00 00 ' found at position 23. // '00 00 00 00 ' found at position 35. // } - + private static void ShowLazyStar() { // @@ -144,7 +144,7 @@ private static void ShowLazyStar() string input = "woof root root rob oof woo woe"; foreach (Match match in Regex.Matches(input, pattern, RegexOptions.IgnoreCase)) Console.WriteLine("'{0}' found at position {1}.", match.Value, match.Index); - + // The example displays the following output: // 'woof' found at position 0. // 'root' found at position 5. @@ -153,7 +153,7 @@ private static void ShowLazyStar() // 'woo' found at position 23. // } - + private static void ShowLazyPlus() { // @@ -161,7 +161,7 @@ private static void ShowLazyPlus() string input = "Aa Bb Cc Dd Ee Ff"; foreach (Match match in Regex.Matches(input, pattern)) Console.WriteLine("'{0}' found at position {1}.", match.Value, match.Index); - + // The example displays the following output: // 'Aa' found at position 0. // 'Bb' found at position 3. @@ -171,22 +171,22 @@ private static void ShowLazyPlus() // 'Ff' found at position 15. // } - + private static void ShowLazyQuestion() { // string pattern = @"^\s*(System.)??Console.Write(Line)??\(??"; - string input = "System.Console.WriteLine(\"Hello!\")\n" + - "Console.Write(\"Hello!\")\n" + - "Console.WriteLine(\"Hello!\")\n" + - "Console.ReadLine()\n" + + string input = "System.Console.WriteLine(\"Hello!\")\n" + + "Console.Write(\"Hello!\")\n" + + "Console.WriteLine(\"Hello!\")\n" + + "Console.ReadLine()\n" + " Console.WriteLine"; - foreach (Match match in Regex.Matches(input, pattern, - RegexOptions.IgnorePatternWhitespace | - RegexOptions.IgnoreCase | + foreach (Match match in Regex.Matches(input, pattern, + RegexOptions.IgnorePatternWhitespace | + RegexOptions.IgnoreCase | RegexOptions.Multiline)) Console.WriteLine("'{0}' found at position {1}.", match.Value, match.Index); - + // The example displays the following output: // 'System.Console.Write' found at position 0. // 'Console.Write' found at position 36. @@ -194,7 +194,7 @@ private static void ShowLazyQuestion() // ' Console.Write' found at position 110. // } - + private static void ShowLazyN() { // @@ -202,28 +202,28 @@ private static void ShowLazyN() string input = "www.microsoft.com msdn.microsoft.com mywebsite mycompany.com"; foreach (Match match in Regex.Matches(input, pattern)) Console.WriteLine("'{0}' found at position {1}.", match.Value, match.Index); - + // The example displays the following output: // 'www.microsoft.com' found at position 0. // 'msdn.microsoft.com' found at position 18. // } - + private static void ShowLazyNComma() { } - + private static void ShowLazyNM() { // string pattern = @"\b[A-Z](\w*?\s*?){1,10}[.!?]"; - string input = "Hi. I am writing a short note. Its purpose is " + - "to test a regular expression that attempts to find " + - "sentences with ten or fewer words. Most sentences " + + string input = "Hi. I am writing a short note. Its purpose is " + + "to test a regular expression that attempts to find " + + "sentences with ten or fewer words. Most sentences " + "in this note are short."; foreach (Match match in Regex.Matches(input, pattern)) Console.WriteLine("'{0}' found at position {1}.", match.Value, match.Index); - + // The example displays the following output: // 'Hi.' found at position 0. // 'I am writing a short note.' found at position 4. diff --git a/samples/snippets/csharp/VS_Snippets_CLR/appcompat.sslprotocols/cs/program.cs b/samples/snippets/csharp/VS_Snippets_CLR/appcompat.sslprotocols/cs/program.cs index a760380497756..c8856ecfe9fb1 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/appcompat.sslprotocols/cs/program.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/appcompat.sslprotocols/cs/program.cs @@ -7,8 +7,8 @@ static void Main() // const string DisableCachingName = @"TestSwitch.LocalAppContext.DisableCaching"; const string DontEnableSchUseStrongCryptoName = @"Switch.System.Net.DontEnableSchUseStrongCrypto"; - AppContext.SetSwitch(DisableCachingName, true); - AppContext.SetSwitch(DontEnableSchUseStrongCryptoName, true); + AppContext.SetSwitch(DisableCachingName, true); + AppContext.SetSwitch(DontEnableSchUseStrongCryptoName, true); // } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/cocontravariancedelegates/cs/example.cs b/samples/snippets/csharp/VS_Snippets_CLR/cocontravariancedelegates/cs/example.cs index 25dc9f91ab051..f14bcc890ac19 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/cocontravariancedelegates/cs/example.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/cocontravariancedelegates/cs/example.cs @@ -12,7 +12,7 @@ public static Derived MyMethod(Base b) return b as Derived ?? new Derived(); } - static void Main() + static void Main() { Func f1 = MyMethod; // diff --git a/samples/snippets/csharp/VS_Snippets_CLR/cocontravariancedelegatesgenrelaxed/cs/example.cs b/samples/snippets/csharp/VS_Snippets_CLR/cocontravariancedelegatesgenrelaxed/cs/example.cs index da83a7cf9b18b..a89355865410c 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/cocontravariancedelegatesgenrelaxed/cs/example.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/cocontravariancedelegatesgenrelaxed/cs/example.cs @@ -12,7 +12,7 @@ public static Type3 MyMethod(Type1 t) return t as Type3 ?? new Type3(); } - static void Main() + static void Main() { Func f1 = MyMethod; diff --git a/samples/snippets/csharp/VS_Snippets_CLR/cocontravarianceinclrgenerici2/cs/example.cs b/samples/snippets/csharp/VS_Snippets_CLR/cocontravarianceinclrgenerici2/cs/example.cs index 9398e14e27814..38ffb22d3874c 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/cocontravarianceinclrgenerici2/cs/example.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/cocontravarianceinclrgenerici2/cs/example.cs @@ -17,8 +17,8 @@ class Circle : Shape class ShapeAreaComparer : System.Collections.Generic.IComparer { - int IComparer.Compare(Shape a, Shape b) - { + int IComparer.Compare(Shape a, Shape b) + { if (a == null) return b == null ? 0 : -1; return b == null ? 1 : a.Area.CompareTo(b.Area); } @@ -29,11 +29,11 @@ class Program static void Main() { // You can pass ShapeAreaComparer, which implements IComparer, - // even though the constructor for SortedSet expects + // even though the constructor for SortedSet expects // IComparer, because type parameter T of IComparer is // contravariant. - SortedSet circlesByArea = - new SortedSet(new ShapeAreaComparer()) + SortedSet circlesByArea = + new SortedSet(new ShapeAreaComparer()) { new Circle(7.2), new Circle(100), null, new Circle(.01) }; foreach (Circle c in circlesByArea) diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.attributes.usage/cs/source2.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.attributes.usage/cs/source2.cs index 139fba7c4af14..aa825fcb16f0f 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.attributes.usage/cs/source2.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.attributes.usage/cs/source2.cs @@ -120,9 +120,9 @@ public class YourAttribute : Attribute #if false // [Developer("Joan Smith", "1")] - + -or- - + [Developer("Joan Smith", "1", Reviewed = true)] // diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.basicio.textfiles/cs/source.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.basicio.textfiles/cs/source.cs index f34f7e167df74..7a6add8235558 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.basicio.textfiles/cs/source.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.basicio.textfiles/cs/source.cs @@ -22,7 +22,7 @@ static void Main(string[] args) WriteTextAsync(); // Example 4: Shows how to synchronously write and - // append to a text file using File + // append to a text file using File WriteFile(); } @@ -30,7 +30,7 @@ static void Main(string[] args) static void WriteLineByLine() { // - + // Create a string array with the lines of text string[] lines = { "First line", "Second line", "Third line" }; @@ -50,7 +50,7 @@ static void WriteLineByLine() static void AppendTextSW() { // - + // Set a variable to the Documents path. string docPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); @@ -65,7 +65,7 @@ static void AppendTextSW() static async void WriteTextAsync() { // - + // Set a variable to the Documents path. string docPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); @@ -80,7 +80,7 @@ static async void WriteTextAsync() static void WriteFile() { // - + // Create a string array with the lines of text string text = "First line" + Environment.NewLine; @@ -95,7 +95,7 @@ static void WriteFile() // Append new lines of text to the file File.AppendAllLines(Path.Combine(docPath,"WriteFile.txt"), lines); - + // } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.basicio.textfiles/cs/source2.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.basicio.textfiles/cs/source2.cs index 09f379f926a1c..82731384b5ce4 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.basicio.textfiles/cs/source2.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.basicio.textfiles/cs/source2.cs @@ -11,7 +11,7 @@ public static void Main() Log("Test1", w); Log("Test2", w); } - + using (StreamReader r = File.OpenText("log.txt")) { DumpLog(r); diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.basicio.textfiles/cs/source5.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.basicio.textfiles/cs/source5.cs index 83b5033b13f3c..02f5bef7a6f7a 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.basicio.textfiles/cs/source5.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.basicio.textfiles/cs/source5.cs @@ -27,7 +27,7 @@ private async void AppendButton_Click(object sender, RoutedEventArgs e) sb.AppendLine(); sb.AppendLine(); - // Open a streamwriter to a new text file named "UserInputFile.txt"and write the contents of + // Open a streamwriter to a new text file named "UserInputFile.txt"and write the contents of // the stringbuilder to it. using (StreamWriter outfile = new StreamWriter(Path.Combine(mydocpath,"UserInputFile.txt"), true)) { diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.basicio.textfiles/cs/write.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.basicio.textfiles/cs/write.cs index 6b474f4b16fae..c515209973941 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.basicio.textfiles/cs/write.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.basicio.textfiles/cs/write.cs @@ -5,7 +5,7 @@ class Program { static void Main(string[] args) { - + // Create a string array with the lines of text string[] lines = { "First line", "Second line", "Third line" }; diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.calendars/cs/calendarinfo1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.calendars/cs/calendarinfo1.cs index 8cc4477fe6401..0542a0cf6bd37 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.calendars/cs/calendarinfo1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.calendars/cs/calendarinfo1.cs @@ -21,20 +21,20 @@ static void DisplayCalendars(CultureInfo ci) // Get the culture's default calendar. Calendar defaultCalendar = ci.Calendar; - Console.Write(" Default Calendar: {0}", GetCalendarName(defaultCalendar)); + Console.Write(" Default Calendar: {0}", GetCalendarName(defaultCalendar)); if (defaultCalendar is GregorianCalendar) - Console.WriteLine(" ({0})", + Console.WriteLine(" ({0})", ((GregorianCalendar) defaultCalendar).CalendarType); else Console.WriteLine(); - + // Get the culture's optional calendars. - Console.WriteLine(" Optional Calendars:"); + Console.WriteLine(" Optional Calendars:"); foreach (var optionalCalendar in ci.OptionalCalendars) { Console.Write("{0,6}{1}", "", GetCalendarName(optionalCalendar)); if (optionalCalendar is GregorianCalendar) - Console.Write(" ({0})", + Console.Write(" ({0})", ((GregorianCalendar) optionalCalendar).CalendarType); Console.WriteLine(); @@ -53,7 +53,7 @@ static string GetCalendarName(Calendar cal) // Optional Calendars: // ThaiBuddhistCalendar // GregorianCalendar (Localized) -// +// // Calendars for the ja-JP culture: // Default Calendar: GregorianCalendar (Localized) // Optional Calendars: diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.calendars/cs/changecalendar2.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.calendars/cs/changecalendar2.cs index f2fbf6cde7984..7cc86cc6487b5 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.calendars/cs/changecalendar2.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.calendars/cs/changecalendar2.cs @@ -11,18 +11,18 @@ public static void Main() DisplayCurrentInfo(); // Display the date using the current culture and calendar. - Console.WriteLine(date1.ToString("d")); + Console.WriteLine(date1.ToString("d")); Console.WriteLine(); - + CultureInfo arSA = CultureInfo.CreateSpecificCulture("ar-SA"); - + // Change the current culture to Arabic (Saudi Arabia). Thread.CurrentThread.CurrentCulture = arSA; // Display date and information about the current culture. DisplayCurrentInfo(); Console.WriteLine(date1.ToString("d")); Console.WriteLine(); - + // Change the calendar to Hijri. Calendar hijri = new HijriCalendar(); if (CalendarExists(arSA, hijri)) { @@ -30,21 +30,21 @@ public static void Main() // Display date and information about the current culture. DisplayCurrentInfo(); Console.WriteLine(date1.ToString("d")); - } + } } private static void DisplayCurrentInfo() { - Console.WriteLine("Current Culture: {0}", + Console.WriteLine("Current Culture: {0}", CultureInfo.CurrentCulture.Name); - Console.WriteLine("Current Calendar: {0}", + Console.WriteLine("Current Calendar: {0}", DateTimeFormatInfo.CurrentInfo.Calendar); } private static bool CalendarExists(CultureInfo culture, Calendar cal) { foreach (Calendar optionalCalendar in culture.OptionalCalendars) - if (cal.ToString().Equals(optionalCalendar.ToString())) + if (cal.ToString().Equals(optionalCalendar.ToString())) return true; return false; @@ -54,11 +54,11 @@ private static bool CalendarExists(CultureInfo culture, Calendar cal) // Current Culture: en-US // Current Calendar: System.Globalization.GregorianCalendar // 6/20/2011 -// +// // Current Culture: ar-SA // Current Calendar: System.Globalization.UmAlQuraCalendar // 18/07/32 -// +// // Current Culture: ar-SA // Current Calendar: System.Globalization.HijriCalendar // 19/07/32 diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.calendars/cs/currentcalendar1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.calendars/cs/currentcalendar1.cs index 6e73348d44dae..42a1f4f1db271 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.calendars/cs/currentcalendar1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.calendars/cs/currentcalendar1.cs @@ -12,15 +12,15 @@ public static void Main() Thread.CurrentThread.CurrentCulture = zhTW; // Define a date. DateTime date1 = new DateTime(2011, 1, 16); - + // Display the date using the default (Gregorian) calendar. - Console.WriteLine("Current calendar: {0}", + Console.WriteLine("Current calendar: {0}", zhTW.DateTimeFormat.Calendar); Console.WriteLine(date1.ToString("d")); - + // Change the current calendar and display the date. - zhTW.DateTimeFormat.Calendar = new TaiwanCalendar(); - Console.WriteLine("Current calendar: {0}", + zhTW.DateTimeFormat.Calendar = new TaiwanCalendar(); + Console.WriteLine("Current calendar: {0}", zhTW.DateTimeFormat.Calendar); Console.WriteLine(date1.ToString("d")); } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.calendars/cs/datesandcalendars2.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.calendars/cs/datesandcalendars2.cs index 52614779752ef..32868ad43b174 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.calendars/cs/datesandcalendars2.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.calendars/cs/datesandcalendars2.cs @@ -7,47 +7,47 @@ public class Example { public static void Main() { - // Make Arabic (Egypt) the current culture - // and Umm al-Qura calendar the current calendar. + // Make Arabic (Egypt) the current culture + // and Umm al-Qura calendar the current calendar. CultureInfo arEG = CultureInfo.CreateSpecificCulture("ar-EG"); Calendar cal = new UmAlQuraCalendar(); arEG.DateTimeFormat.Calendar = cal; Thread.CurrentThread.CurrentCulture = arEG; // Display information on current culture and calendar. - DisplayCurrentInfo(); + DisplayCurrentInfo(); // Instantiate a date object. DateTime date1 = new DateTime(2011, 7, 15); // Display the string representation of the date. Console.WriteLine("Date: {0:d}", date1); - Console.WriteLine("Date in the Invariant Culture: {0}", + Console.WriteLine("Date in the Invariant Culture: {0}", date1.ToString("d", CultureInfo.InvariantCulture)); Console.WriteLine(); - + // Compare DateTime properties and Calendar methods. Console.WriteLine("DateTime.Month property: {0}", date1.Month); - Console.WriteLine("UmAlQura.GetMonth: {0}", + Console.WriteLine("UmAlQura.GetMonth: {0}", cal.GetMonth(date1)); Console.WriteLine(); Console.WriteLine("DateTime.Day property: {0}", date1.Day); - Console.WriteLine("UmAlQura.GetDayOfMonth: {0}", - cal.GetDayOfMonth(date1)); + Console.WriteLine("UmAlQura.GetDayOfMonth: {0}", + cal.GetDayOfMonth(date1)); Console.WriteLine(); - + Console.WriteLine("DateTime.Year property: {0:D4}", date1.Year); - Console.WriteLine("UmAlQura.GetYear: {0}", - cal.GetYear(date1)); + Console.WriteLine("UmAlQura.GetYear: {0}", + cal.GetYear(date1)); Console.WriteLine(); } private static void DisplayCurrentInfo() { - Console.WriteLine("Current Culture: {0}", + Console.WriteLine("Current Culture: {0}", CultureInfo.CurrentCulture.Name); - Console.WriteLine("Current Calendar: {0}", + Console.WriteLine("Current Calendar: {0}", DateTimeFormatInfo.CurrentInfo.Calendar); } } @@ -56,13 +56,13 @@ private static void DisplayCurrentInfo() // Current Calendar: System.Globalization.UmAlQuraCalendar // Date: 14/08/32 // Date in the Invariant Culture: 07/15/2011 -// +// // DateTime.Month property: 7 // UmAlQura.GetMonth: 8 -// +// // DateTime.Day property: 15 // UmAlQura.GetDayOfMonth: 14 -// +// // DateTime.Year property: 2011 // UmAlQura.GetYear: 1432 // diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.calendars/cs/formatstrings1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.calendars/cs/formatstrings1.cs index bf149dbc9ab73..05093071927c5 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.calendars/cs/formatstrings1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.calendars/cs/formatstrings1.cs @@ -10,19 +10,19 @@ public static void Main() { StreamWriter sw = new StreamWriter(@".\eras.txt"); DateTime dt = new DateTime(2012, 5, 1); - + CultureInfo culture = CultureInfo.CreateSpecificCulture("ja-JP"); DateTimeFormatInfo dtfi = culture.DateTimeFormat; dtfi.Calendar = new JapaneseCalendar(); Thread.CurrentThread.CurrentCulture = culture; - + sw.WriteLine("\n{0,-43} {1}", "Full Date and Time Pattern:", dtfi.FullDateTimePattern); sw.WriteLine(dt.ToString("F")); sw.WriteLine(); - + sw.WriteLine("\n{0,-43} {1}", "Long Date Pattern:", dtfi.LongDatePattern); sw.WriteLine(dt.ToString("D")); - + sw.WriteLine("\n{0,-43} {1}", "Short Date Pattern:", dtfi.ShortDatePattern); sw.WriteLine(dt.ToString("d")); sw.Close(); @@ -31,10 +31,10 @@ public static void Main() // The example writes the following output to a file: // Full Date and Time Pattern: gg y'年'M'月'd'日' H:mm:ss // 平成 24年5月1日 0:00:00 -// +// // Long Date Pattern: gg y'年'M'月'd'日' // 平成 24年5月1日 -// +// // Short Date Pattern: gg y/M/d // 平成 24/5/1 // diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.calendars/cs/formatstrings2.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.calendars/cs/formatstrings2.cs index 24347b37398a1..ed01a31fdc84e 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.calendars/cs/formatstrings2.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.calendars/cs/formatstrings2.cs @@ -8,7 +8,7 @@ public static void Main() DateTime dat = new DateTime(2012, 5, 1); Console.WriteLine("{0:MM-dd-yyyy g}", dat); // The example displays the following output: - // 05-01-2012 A.D. + // 05-01-2012 A.D. // } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.calendars/cs/formatstrings3.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.calendars/cs/formatstrings3.cs index 55c2bcc7a4b99..e69aabeb05879 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.calendars/cs/formatstrings3.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.calendars/cs/formatstrings3.cs @@ -8,23 +8,23 @@ public static void Main() { DateTime date1 = new DateTime(2011, 8, 28); Calendar cal = new JapaneseLunisolarCalendar(); - - Console.WriteLine("{0} {1:d4}/{2:d2}/{3:d2}", + + Console.WriteLine("{0} {1:d4}/{2:d2}/{3:d2}", cal.GetEra(date1), cal.GetYear(date1), cal.GetMonth(date1), - cal.GetDayOfMonth(date1)); - + cal.GetDayOfMonth(date1)); + // Display eras CultureInfo culture = CultureInfo.CreateSpecificCulture("ja-JP"); DateTimeFormatInfo dtfi = culture.DateTimeFormat; dtfi.Calendar = new JapaneseCalendar(); - - Console.WriteLine("{0} {1:d4}/{2:d2}/{3:d2}", + + Console.WriteLine("{0} {1:d4}/{2:d2}/{3:d2}", dtfi.GetAbbreviatedEraName(cal.GetEra(date1)), cal.GetYear(date1), cal.GetMonth(date1), - cal.GetDayOfMonth(date1)); + cal.GetDayOfMonth(date1)); } } // The example displays the following output: diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.calendars/cs/instantiatehcdate1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.calendars/cs/instantiatehcdate1.cs index 94dc9874ef2c1..b02efa5d3bc24 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.calendars/cs/instantiatehcdate1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.calendars/cs/instantiatehcdate1.cs @@ -10,19 +10,19 @@ public static void Main() DateTime date1 = new DateTime(5771, 6, 1, hc); DateTime date2 = hc.ToDateTime(5771, 6, 1, 0, 0, 0, 0); - + Console.WriteLine("{0:d} (Gregorian) = {1:d2}/{2:d2}/{3:d4} ({4}): {5}", - date1, + date1, hc.GetMonth(date2), hc.GetDayOfMonth(date2), - hc.GetYear(date2), + hc.GetYear(date2), GetCalendarName(hc), date1.Equals(date2)); } - + private static string GetCalendarName(Calendar cal) { - return cal.ToString().Replace("System.Globalization.", ""). + return cal.ToString().Replace("System.Globalization.", ""). Replace("Calendar", ""); } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.calendars/cs/instantiatewithera1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.calendars/cs/instantiatewithera1.cs index 5b379f779ad26..2bb0da63e546b 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.calendars/cs/instantiatewithera1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.calendars/cs/instantiatewithera1.cs @@ -12,16 +12,16 @@ public static void Main() Console.WriteLine("\nDate instantiated without an era:"); DateTime date1 = new DateTime(year, month, day, 0, 0, 0, 0, cal); - Console.WriteLine("{0}/{1}/{2} in Japanese Calendar -> {3:d} in Gregorian", + Console.WriteLine("{0}/{1}/{2} in Japanese Calendar -> {3:d} in Gregorian", cal.GetMonth(date1), cal.GetDayOfMonth(date1), cal.GetYear(date1), date1); - + Console.WriteLine("\nDates instantiated with eras:"); foreach (int era in cal.Eras) { DateTime date2 = cal.ToDateTime(year, month, day, 0, 0, 0, 0, era); - Console.WriteLine("{0}/{1}/{2} era {3} in Japanese Calendar -> {4:d} in Gregorian", + Console.WriteLine("{0}/{1}/{2} era {3} in Japanese Calendar -> {4:d} in Gregorian", cal.GetMonth(date2), cal.GetDayOfMonth(date2), cal.GetYear(date2), cal.GetEra(date2), date2); - } + } } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.calendars/cs/minsupporteddatetime1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.calendars/cs/minsupporteddatetime1.cs index 99de90f1e2ac7..a5c495e2ab090 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.calendars/cs/minsupporteddatetime1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.calendars/cs/minsupporteddatetime1.cs @@ -8,49 +8,49 @@ public class Example public static void Main() { DateTime dat = DateTime.MinValue; - + // Change the current culture to ja-JP with the Japanese Calendar. CultureInfo jaJP = CultureInfo.CreateSpecificCulture("ja-JP"); jaJP.DateTimeFormat.Calendar = new JapaneseCalendar(); Thread.CurrentThread.CurrentCulture = jaJP; - Console.WriteLine("Earliest supported date by {1} calendar: {0:d}", + Console.WriteLine("Earliest supported date by {1} calendar: {0:d}", jaJP.DateTimeFormat.Calendar.MinSupportedDateTime, GetCalendarName(jaJP)); // Attempt to display the date. - Console.WriteLine(dat.ToString()); + Console.WriteLine(dat.ToString()); Console.WriteLine(); - + // Change the current culture to ar-EG with the Um Al Qura calendar. CultureInfo arEG = CultureInfo.CreateSpecificCulture("ar-EG"); arEG.DateTimeFormat.Calendar = new UmAlQuraCalendar(); Thread.CurrentThread.CurrentCulture = arEG; - Console.WriteLine("Earliest supported date by {1} calendar: {0:d}", + Console.WriteLine("Earliest supported date by {1} calendar: {0:d}", arEG.DateTimeFormat.Calendar.MinSupportedDateTime, GetCalendarName(arEG)); // Attempt to display the date. - Console.WriteLine(dat.ToString()); + Console.WriteLine(dat.ToString()); Console.WriteLine(); - + // Change the current culture to en-US. Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-US"); Console.WriteLine(dat.ToString(jaJP)); Console.WriteLine(dat.ToString(arEG)); Console.WriteLine(dat.ToString("d")); } - + private static string GetCalendarName(CultureInfo culture) { Calendar cal = culture.DateTimeFormat.Calendar; - return cal.GetType().Name.Replace("System.Globalization.", "").Replace("Calendar", ""); + return cal.GetType().Name.Replace("System.Globalization.", "").Replace("Calendar", ""); } } // The example displays the following output: // Earliest supported date by Japanese calendar: 明治 1/9/8 // 0001-01-01T00:00:00 -// +// // Earliest supported date by UmAlQura calendar: 01/01/18 // 0001-01-01T00:00:00 -// +// // 0001-01-01T00:00:00 // 0001-01-01T00:00:00 // 1/1/0001 diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.calendars/cs/noncurrentcalendar1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.calendars/cs/noncurrentcalendar1.cs index ec645700a8a90..a05bcff4547cd 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.calendars/cs/noncurrentcalendar1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.calendars/cs/noncurrentcalendar1.cs @@ -8,8 +8,8 @@ public static void Main() { JulianCalendar julian = new JulianCalendar(); DateTime date1 = new DateTime(1905, 1, 9, julian); - - Console.WriteLine("Date ({0}): {1:d}", + + Console.WriteLine("Date ({0}): {1:d}", CultureInfo.CurrentCulture.Calendar, date1); Console.WriteLine("Date in Julian calendar: {0:d2}/{1:d2}/{2:d4}", diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.cancellation.callback/cs/howtoexample1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.cancellation.callback/cs/howtoexample1.cs index 74f6df8a17256..27b2d3a73e395 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.cancellation.callback/cs/howtoexample1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.cancellation.callback/cs/howtoexample1.cs @@ -10,7 +10,7 @@ static void Main() { var cts = new CancellationTokenSource(); var token = cts.Token; - + // Start cancelable task. Task t = Task.Run( () => { WebClient wc = new WebClient(); diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.choosingdates/cs/datetimereplacement1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.choosingdates/cs/datetimereplacement1.cs index 6af60cdc210a7..a909c3e5e643c 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.choosingdates/cs/datetimereplacement1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.choosingdates/cs/datetimereplacement1.cs @@ -12,7 +12,7 @@ public bool IsOpenNow() { return IsOpenAt(DateTime.Now.TimeOfDay); } - + public bool IsOpenAt(TimeSpan time) { TimeZoneInfo local = TimeZoneInfo.Local; @@ -25,7 +25,7 @@ public bool IsOpenAt(TimeSpan time) else { TimeSpan delta = TimeSpan.Zero; TimeSpan storeDelta = TimeSpan.Zero; - + // Is it daylight saving time in either time zone? if (local.IsDaylightSavingTime(DateTime.Now.Date + time)) delta = local.GetAdjustmentRules()[local.GetAdjustmentRules().Length - 1].DaylightDelta; @@ -53,7 +53,7 @@ public static void Main() store103.open = new TimeSpan(8, 0, 0); // Store closes at 9:30. store103.close = new TimeSpan(21, 30, 0); - + Console.WriteLine("Store is open now at {0}: {1}", DateTime.Now.TimeOfDay, store103.IsOpenNow()); TimeSpan[] times = { new TimeSpan(8, 0, 0), new TimeSpan(21, 0, 0), diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/accessibility1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/accessibility1.cs index 37e10d5697e40..eb55c64d8649c 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/accessibility1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/accessibility1.cs @@ -6,43 +6,43 @@ public class Animal { private string _species; - + public Animal(string species) { _species = species; } - - public virtual string Species - { + + public virtual string Species + { get { return _species; } } - + public override string ToString() { - return _species; - } + return _species; + } } public class Human : Animal { private string _name; - + public Human(string name) : base("Homo Sapiens") { _name = name; } - + public string Name { get { return _name; } } - - private override string Species + + private override string Species { get { return base.Species; } } - - public override string ToString() + + public override string ToString() { return _name; } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/accessibility3.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/accessibility3.cs index 8520dac62b694..940548b5e7c02 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/accessibility3.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/accessibility3.cs @@ -7,18 +7,18 @@ public class StringWrapper string internalString; StringBuilder internalSB = null; bool useSB = false; - + public StringWrapper(StringOperationType type) - { + { if (type == StringOperationType.Normal) { useSB = false; - } + } else { useSB = true; internalSB = new StringBuilder(); - } + } } - + // The remaining source code... } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/array1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/array1.cs index 7bcc49db720c6..f613fefa2e9de 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/array1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/array1.cs @@ -20,7 +20,7 @@ public static Array GetTenPrimes() arr.SetValue(19, 9); arr.SetValue(23, 10); - return arr; + return arr; } } // diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/array2.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/array2.cs index 9685bef096f99..1c62f90427bba 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/array2.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/array2.cs @@ -10,7 +10,7 @@ public static UInt32[] GetTenPrimes() uint[] arr = { 1u, 2u, 3u, 5u, 7u, 11u, 13u, 17u, 19u }; return arr; } - + public static Object[] GetFivePrimes() { Object[] arr = { 1, 2, 3, 5u, 7u }; @@ -20,7 +20,7 @@ public static Object[] GetFivePrimes() // Compilation produces a compiler warning like the following: // Array2.cs(8,27): warning CS3002: Return type of 'Numbers.GetTenPrimes()' is not // CLS-compliant -// +// public class Example { diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/array3.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/array3.cs index 822a9c03f556d..3170cff2e351f 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/array3.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/array3.cs @@ -10,10 +10,10 @@ public static byte[] GetSquares(byte[] numbers) { byte[] numbersOut = new byte[numbers.Length]; for (int ctr = 0; ctr < numbers.Length; ctr++) { - int square = ((int) numbers[ctr]) * ((int) numbers[ctr]); + int square = ((int) numbers[ctr]) * ((int) numbers[ctr]); if (square <= Byte.MaxValue) numbersOut[ctr] = (byte) square; - // If there's an overflow, assign MaxValue to the corresponding + // If there's an overflow, assign MaxValue to the corresponding // element. else numbersOut[ctr] = Byte.MaxValue; @@ -25,7 +25,7 @@ public static BigInteger[] GetSquares(BigInteger[] numbers) { BigInteger[] numbersOut = new BigInteger[numbers.Length]; for (int ctr = 0; ctr < numbers.Length; ctr++) - numbersOut[ctr] = numbers[ctr] * numbers[ctr]; + numbersOut[ctr] = numbers[ctr] * numbers[ctr]; return numbersOut; } @@ -36,8 +36,8 @@ public class Example { public static void Main() { - Byte[] bytes = Numbers.GetSquares( new Byte[] { (byte) 3, (byte) 10, - (byte) 13, (byte) 20 } ); + Byte[] bytes = Numbers.GetSquares( new Byte[] { (byte) 3, (byte) 10, + (byte) 13, (byte) 20 } ); foreach (var byt in bytes) Console.Write("{0} ", byt); diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/attribute1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/attribute1.cs index 11525b2aa81b2..3b221aee09647 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/attribute1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/attribute1.cs @@ -3,17 +3,17 @@ [assembly: CLSCompliant(true)] -[AttributeUsageAttribute(AttributeTargets.Class | AttributeTargets.Struct)] +[AttributeUsageAttribute(AttributeTargets.Class | AttributeTargets.Struct)] public class NumericAttribute { private bool _isNumeric; - + public NumericAttribute(bool isNumeric) { _isNumeric = isNumeric; } - - public bool IsNumeric + + public bool IsNumeric { get { return _isNumeric; } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/attribute2.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/attribute2.cs index 7c2cf08ae9e14..2cd2b7b507c9f 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/attribute2.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/attribute2.cs @@ -8,21 +8,21 @@ public enum DescriptorType { type, member }; public class Descriptor { public DescriptorType Type; - public String Description; + public String Description; } [AttributeUsage(AttributeTargets.All)] public class DescriptionAttribute : Attribute { private Descriptor desc; - + public DescriptionAttribute(Descriptor d) { - desc = d; + desc = d; } - + public Descriptor Descriptor - { get { return desc; } } + { get { return desc; } } } // Attempting to compile the example displays output like the following: // warning CS3015: 'DescriptionAttribute' has no accessible diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/box2.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/box2.cs index 3392570e1126e..b096b145fd830 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/box2.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/box2.cs @@ -6,14 +6,14 @@ public unsafe class TestClass { private int* val; - + public TestClass(int number) { val = (int*) number; } public int* Value { - get { return val; } + get { return val; } } } // The compiler generates the following output when compiling this example: diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/convert1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/convert1.cs index 7a09a77add805..6c8b71d72033b 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/convert1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/convert1.cs @@ -4,7 +4,7 @@ public struct UDouble { private double number; - + public UDouble(double value) { if (value < 0) @@ -12,7 +12,7 @@ public UDouble(double value) number = value; } - + public UDouble(float value) { if (value < 0) @@ -20,30 +20,30 @@ public UDouble(float value) number = value; } - + public static readonly UDouble MinValue = (UDouble) 0.0; public static readonly UDouble MaxValue = (UDouble) Double.MaxValue; - + public static explicit operator Double(UDouble value) { return value.number; } - + public static implicit operator Single(UDouble value) { - if (value.number > (double) Single.MaxValue) + if (value.number > (double) Single.MaxValue) throw new InvalidCastException("A UDouble value is out of range of the Single type."); - return (float) value.number; + return (float) value.number; } - + public static explicit operator UDouble(double value) { if (value < 0) throw new InvalidCastException("A negative value cannot be converted to a UDouble."); return new UDouble(value); - } + } public static implicit operator UDouble(float value) { @@ -51,27 +51,27 @@ public static implicit operator UDouble(float value) throw new InvalidCastException("A negative value cannot be converted to a UDouble."); return new UDouble(value); - } + } public static Double ToDouble(UDouble value) { return (Double) value; - } + } public static float ToSingle(UDouble value) { return (float) value; - } + } public static UDouble FromDouble(double value) { return new UDouble(value); } - + public static UDouble FromSingle(float value) { return new UDouble(value); - } + } } // diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/ctor1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/ctor1.cs index e22e0d31f2c05..da0d4a1dd767f 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/ctor1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/ctor1.cs @@ -6,35 +6,35 @@ public class Person { private string fName, lName, _id; - + public Person(string firstName, string lastName, string id) { if (String.IsNullOrEmpty(firstName + lastName)) - throw new ArgumentNullException("Either a first name or a last name must be provided."); - + throw new ArgumentNullException("Either a first name or a last name must be provided."); + fName = firstName; lName = lastName; _id = id; } - - public string FirstName + + public string FirstName { get { return fName; } } - public string LastName + public string LastName { get { return lName; } } - - public string Id + + public string Id { get { return _id; } } public override string ToString() { - return String.Format("{0}{1}{2}", fName, + return String.Format("{0}{1}{2}", fName, String.IsNullOrEmpty(fName) ? "" : " ", lName); } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/eii1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/eii1.cs index f44dfe444f3e8..dd076a091fdc5 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/eii1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/eii1.cs @@ -16,13 +16,13 @@ public interface ICelsius public class Temperature : ICelsius, IFahrenheit { private decimal _value; - + public Temperature(decimal value) { // We assume that this is the Celsius value. _value = value; - } - + } + decimal IFahrenheit.GetTemperature() { return _value * 9 / 5 + 32; @@ -31,7 +31,7 @@ decimal IFahrenheit.GetTemperature() decimal ICelsius.GetTemperature() { return _value; - } + } } public class Example { @@ -40,9 +40,9 @@ public static void Main() Temperature temp = new Temperature(100.0m); ICelsius cTemp = temp; IFahrenheit fTemp = temp; - Console.WriteLine("Temperature in Celsius: {0} degrees", + Console.WriteLine("Temperature in Celsius: {0} degrees", cTemp.GetTemperature()); - Console.WriteLine("Temperature in Fahrenheit: {0} degrees", + Console.WriteLine("Temperature in Fahrenheit: {0} degrees", fTemp.GetTemperature()); } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/enum3.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/enum3.cs index eaa99a7066181..9c280eeec229c 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/enum3.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/enum3.cs @@ -3,18 +3,18 @@ [assembly: CLSCompliant(true)] -public enum Size : uint { - Unspecified = 0, - XSmall = 1, - Small = 2, - Medium = 3, - Large = 4, - XLarge = 5 +public enum Size : uint { + Unspecified = 0, + XSmall = 1, + Small = 2, + Medium = 3, + Large = 4, + XLarge = 5 }; public class Clothing { - public string Name; + public string Name; public string Type; public string Size; } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/event1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/event1.cs index 13e57e048873c..ae5d0f1ef2937 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/event1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/event1.cs @@ -8,26 +8,26 @@ public class TemperatureChangedEventArgs : EventArgs { private Decimal originalTemp; - private Decimal newTemp; + private Decimal newTemp; private DateTimeOffset when; - + public TemperatureChangedEventArgs(Decimal original, Decimal @new, DateTimeOffset time) { originalTemp = original; newTemp = @new; when = time; - } - + } + public Decimal OldTemperature { get { return originalTemp; } - } - + } + public Decimal CurrentTemperature { get { return newTemp; } - } - + } + public DateTimeOffset Time { get { return when; } @@ -43,14 +43,14 @@ private struct TemperatureInfo public Decimal Temperature; public DateTimeOffset Recorded; } - + public event TemperatureChanged TemperatureChanged; private Decimal previous; private Decimal current; private Decimal tolerance; private List tis = new List(); - + public Temperature(Decimal temperature, Decimal tolerance) { current = temperature; @@ -60,7 +60,7 @@ public Temperature(Decimal temperature, Decimal tolerance) ti.Recorded = DateTimeOffset.UtcNow; this.tolerance = tolerance; } - + public Decimal CurrentTemperature { get { return current; } @@ -70,15 +70,15 @@ public Decimal CurrentTemperature ti.Recorded = DateTimeOffset.UtcNow; previous = current; current = value; - if (Math.Abs(current - previous) >= tolerance) + if (Math.Abs(current - previous) >= tolerance) raise_TemperatureChanged(new TemperatureChangedEventArgs(previous, current, ti.Recorded)); } } - + public void raise_TemperatureChanged(TemperatureChangedEventArgs eventArgs) { if (TemperatureChanged == null) - return; + return; foreach (TemperatureChanged d in TemperatureChanged.GetInvocationList()) { if (d.Method.Name.Contains("Duplicate")) @@ -92,7 +92,7 @@ public void raise_TemperatureChanged(TemperatureChangedEventArgs eventArgs) public class Example { public Temperature temp; - + public static void Main() { Example ex = new Example(); @@ -106,28 +106,28 @@ public Example() Example ex = new Example(temp); ex.RecordTemperatures(); } - + public Example(Temperature t) { temp = t; RecordTemperatures(); } - + public void RecordTemperatures() { temp.TemperatureChanged += this.DuplicateTemperatureNotification; temp.CurrentTemperature = 66; temp.CurrentTemperature = 63; } - - internal void TemperatureNotification(Object sender, TemperatureChangedEventArgs e) + + internal void TemperatureNotification(Object sender, TemperatureChangedEventArgs e) { - Console.WriteLine("Notification 1: The temperature changed from {0} to {1}", e.OldTemperature, e.CurrentTemperature); + Console.WriteLine("Notification 1: The temperature changed from {0} to {1}", e.OldTemperature, e.CurrentTemperature); } - + public void DuplicateTemperatureNotification(Object sender, TemperatureChangedEventArgs e) - { - Console.WriteLine("Notification 2: The temperature changed from {0} to {1}", e.OldTemperature, e.CurrentTemperature); + { + Console.WriteLine("Notification 2: The temperature changed from {0} to {1}", e.OldTemperature, e.CurrentTemperature); } } // diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/exceptions1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/exceptions1.cs index b379e0973c32a..45d57ae6b0b51 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/exceptions1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/exceptions1.cs @@ -4,14 +4,14 @@ [assembly: CLSCompliant(true)] public class ErrorClass -{ +{ string msg; - + public ErrorClass(string errorMessage) { msg = errorMessage; } - + public string Message { get { return msg; } @@ -26,7 +26,7 @@ public static string[] SplitString(this string value, int index) ErrorClass badIndex = new ErrorClass("The index is not within the string."); throw badIndex; } - string[] retVal = { value.Substring(0, index - 1), + string[] retVal = { value.Substring(0, index - 1), value.Substring(index) }; return retVal; } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/exceptions2.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/exceptions2.cs index c1e3d21d04365..920ff43097c3c 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/exceptions2.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/exceptions2.cs @@ -4,14 +4,14 @@ [assembly: CLSCompliant(true)] public class ErrorClass : Exception -{ +{ string msg; - + public ErrorClass(string errorMessage) { msg = errorMessage; } - + public override string Message { get { return msg; } @@ -26,7 +26,7 @@ public static string[] SplitString(this string value, int index) ErrorClass badIndex = new ErrorClass("The index is not within the string."); throw badIndex; } - string[] retVal = { value.Substring(0, index - 1), + string[] retVal = { value.Substring(0, index - 1), value.Substring(index) }; return retVal; } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/generics2.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/generics2.cs index 38dbe785e79c8..8296398676655 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/generics2.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/generics2.cs @@ -8,12 +8,12 @@ public class Number where T : struct // use Double as the underlying type, since its range is a superset of // the ranges of all numeric types except BigInteger. protected double number; - + public Number(T value) { try { this.number = Convert.ToDouble(value); - } + } catch (OverflowException e) { throw new ArgumentException("value is too large.", e); } @@ -32,19 +32,19 @@ public T Subtract(T value) return (T) Convert.ChangeType(number - Convert.ToDouble(value), typeof(T)); } } - -public class FloatingPoint : Number where T : struct + +public class FloatingPoint : Number where T : struct { - public FloatingPoint(T number) : base(number) + public FloatingPoint(T number) : base(number) { if (typeof(float) == number.GetType() || - typeof(double) == number.GetType() || + typeof(double) == number.GetType() || typeof(decimal) == number.GetType()) this.number = Convert.ToDouble(number); - else + else throw new ArgumentException("The number parameter is not a floating-point number."); - } -} + } +} // public class Example @@ -53,19 +53,19 @@ public static void Main() { Number byt = new Number(12); Console.WriteLine(byt.Add(12)); - + Number sbyt = new Number(-3); Console.WriteLine(sbyt.Subtract(12)); - + Number ush = new Number(16); Console.WriteLine(ush.Add((ushort)3)); - + Number dbl = new Number(Math.PI); Console.WriteLine(dbl.Add(1.0)); - + FloatingPoint sng = new FloatingPoint(12.3f); Console.WriteLine(sng.Add(3.0f)); - + // FloatingPoint f2 = new FloatingPoint(16); // Console.WriteLine(f2.Add(6)); } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/generics2a.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/generics2a.cs index 93c4f5f425aa7..b57aacae46c2e 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/generics2a.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/generics2a.cs @@ -8,12 +8,12 @@ public class Number where T : struct // use Double as the underlying type, since its range is a superset of // the ranges of all numeric types except BigInteger. protected double number; - + public Number(T value) { try { this.number = Convert.ToDouble(value); - } + } catch (OverflowException e) { throw new ArgumentException("value is too large.", e); } @@ -32,19 +32,19 @@ public T Subtract(T value) return (T) Convert.ChangeType(number - Convert.ToDouble(value), typeof(T)); } } - -public class FloatingPoint : Number + +public class FloatingPoint : Number { - public FloatingPoint(T number) : base(number) + public FloatingPoint(T number) : base(number) { if (typeof(float) == number.GetType() || - typeof(double) == number.GetType() || + typeof(double) == number.GetType() || typeof(decimal) == number.GetType()) this.number = Convert.ToDouble(number); - else + else throw new ArgumentException("The number parameter is not a floating-point number."); - } -} + } +} // The attempt to comple the example displays the following output: // error CS0453: The type 'T' must be a non-nullable value type in // order to use it as parameter 'T' in the generic type or method 'Number' @@ -56,19 +56,19 @@ public static void Main() { Number byt = new Number(12); Console.WriteLine(byt.Add(12)); - + Number sbyt = new Number(-3); Console.WriteLine(sbyt.Subtract(12)); - + Number ush = new Number(16); Console.WriteLine(ush.Add((ushort)3)); - + Number dbl = new Number(Math.PI); Console.WriteLine(dbl.Add(1.0)); - + FloatingPoint sng = new FloatingPoint(12.3f); Console.WriteLine(sng.Add(3.0f)); - + // FloatingPoint f2 = new FloatingPoint(16); // Console.WriteLine(f2.Add(6)); } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/generics4.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/generics4.cs index 50f2828d45218..70db7830ae061 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/generics4.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/generics4.cs @@ -3,7 +3,7 @@ [assembly:CLSCompliant(true)] -public class C1 +public class C1 { protected class N { } @@ -14,7 +14,7 @@ protected void M2(C1.N n) { } // CLS-compliant – C1.N accessible // inside C1 } -public class C2 : C1 +public class C2 : C1 { protected void M3(C1.N n) { } // Not CLS-compliant – C1.N is not // accessible in C2 (extends C1) diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/indicator3.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/indicator3.cs index 044ecbf6baf80..4b4a09dd54676 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/indicator3.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/indicator3.cs @@ -14,9 +14,9 @@ public class CharacterUtilities [CLSCompliant(false)] public static ushort ToUTF16(Char ch) { - return Convert.ToUInt16(ch); + return Convert.ToUInt16(ch); } - + // CLS-compliant alternative for ToUTF16(String). public static int ToUTF16CodeUnit(String s) { @@ -33,7 +33,7 @@ public static int ToUTF16CodeUnit(Char ch) public bool HasMultipleRepresentations(String s) { String s1 = s.Normalize(NormalizationForm.FormC); - return s.Equals(s1); + return s.Equals(s1); } public int GetUnicodeCodePoint(Char ch) @@ -41,9 +41,9 @@ public int GetUnicodeCodePoint(Char ch) if (Char.IsSurrogate(ch)) throw new ArgumentException("ch cannot be a high or low surrogate."); - return Char.ConvertToUtf32(ch.ToString(), 0); + return Char.ConvertToUtf32(ch.ToString(), 0); } - + public int GetUnicodeCodePoint(Char[] chars) { if (chars.Length > 2) @@ -57,7 +57,7 @@ public int GetUnicodeCodePoint(Char[] chars) } else { return Char.ConvertToUtf32(chars.ToString(), 0); - } + } } } // diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/naming1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/naming1.cs index b82dc9c12059c..89ce5d2e2d7d0 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/naming1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/naming1.cs @@ -11,7 +11,7 @@ public class person { } // Compilation produces a compiler warning like the following: -// Naming1.cs(11,14): warning CS3005: Identifier 'person' differing +// Naming1.cs(11,14): warning CS3005: Identifier 'person' differing // only in case is not CLS-compliant // Naming1.cs(6,14): (Location of symbol related to previous warning) // @@ -21,13 +21,13 @@ public class Size { private double a1; private double a2; - + public double Å { get { return a1; } set { a1 = value; } - } - + } + public double Å { get { return a2; } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/naming3.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/naming3.cs index 913f8094db706..6985a485fa6cc 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/naming3.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/naming3.cs @@ -14,17 +14,17 @@ public float Conversion(int number) { return (float) number; } - + public double Conversion(long number) { return (double) number; } - + public bool Conversion { get { return true; } - } -} + } +} // Compilation produces a compiler error like the following: // Naming3.cs(13,17): error CS0111: Type 'Converter' already defines a member called // 'Conversion' with the same parameter types diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/nestedgenerics2.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/nestedgenerics2.cs index 7fa17aeec2896..d2b1f5de17490 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/nestedgenerics2.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/nestedgenerics2.cs @@ -6,22 +6,22 @@ public class Outer { T value; - + public Outer(T value) { this.value = value; } - + public class Inner1A : Outer { public Inner1A(T value) : base(value) { } } - + public class Inner1B : Outer { U value2; - + public Inner1B(T value1, U value2) : base(value1) { this.value2 = value2; @@ -35,10 +35,10 @@ public static void Main() { var inst1 = new Outer("This"); Console.WriteLine(inst1); - + var inst2 = new Outer.Inner1A("Another"); Console.WriteLine(inst2); - + var inst3 = new Outer.Inner1B("That", 2); Console.WriteLine(inst3); } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/paramarray1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/paramarray1.cs index 4ab635480f6e7..19ec53ab253f2 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/paramarray1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/paramarray1.cs @@ -6,13 +6,13 @@ public class Group { private string[] members; - + public Group(params string[] memberList) { members = memberList; } - - public override string ToString() + + public override string ToString() { return String.Join(", ", members); } @@ -23,7 +23,7 @@ public class Example public static void Main() { Group gp = new Group("Matthew", "Mark", "Luke", "John"); - Console.WriteLine(gp.ToString()); + Console.WriteLine(gp.ToString()); } } // The example displays the following output: diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/public1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/public1.cs index 4981dc0e9b9c9..6436161c5129f 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/public1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/public1.cs @@ -7,7 +7,7 @@ public class Person { private UInt16 personAge = 0; - public UInt16 Age + public UInt16 Age { get { return personAge; } } } // The attempt to compile the example displays the following compiler warning: diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/public2.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/public2.cs index 45c9dbc5d358c..7aa3ccdb83168 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/public2.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/public2.cs @@ -7,7 +7,7 @@ public class Person { private Int16 personAge = 0; - public Int16 Age + public Int16 Age { get { return personAge; } } } // diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/type2.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/type2.cs index 735b050562d7b..6cee8da33691c 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/type2.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/type2.cs @@ -14,7 +14,7 @@ public InvoiceItem(int sku, Nullable quantity) if (sku <= 0) throw new ArgumentOutOfRangeException("The item number is zero or negative."); itemId = (uint) sku; - + qty = quantity; } @@ -27,7 +27,7 @@ public Nullable Quantity public int InvoiceId { get { return (int) invId; } - set { + set { if (value <= 0) throw new ArgumentOutOfRangeException("The invoice number is zero or negative."); invId = (uint) value; } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/type3.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/type3.cs index ff2c3df4c1fdb..67f7ea621ae8a 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/type3.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/type3.cs @@ -3,21 +3,21 @@ [assembly: CLSCompliant(true)] -[CLSCompliant(false)] +[CLSCompliant(false)] public class Counter { UInt32 ctr; - + public Counter() { ctr = 0; } - + protected Counter(UInt32 ctr) { this.ctr = ctr; } - + public override string ToString() { return String.Format("{0}). ", ctr); @@ -27,8 +27,8 @@ public UInt32 Value { get { return ctr; } } - - public void Increment() + + public void Increment() { ctr += (uint) 1; } @@ -39,7 +39,7 @@ public class NonZeroCounter : Counter public NonZeroCounter(int startIndex) : this((uint) startIndex) { } - + private NonZeroCounter(UInt32 startIndex) : base(startIndex) { } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/unmanagedptr1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/unmanagedptr1.cs index 68d890ca26ec2..7795246603dea 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/unmanagedptr1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/unmanagedptr1.cs @@ -16,7 +16,7 @@ unsafe public static Array CreateInstance(Type type, int* ptr, int items) } return arr; } -} +} // The attempt to compile this example displays the following output: // UnmanagedPtr1.cs(8,57): warning CS3001: Argument type 'int*' is not CLS-compliant // @@ -30,7 +30,7 @@ public static void Main() unsafe { fixed(int* ptr = numbers) { numbers2 = (int[]) ArrayHelper.CreateInstance(typeof(int), ptr, numbers.Length); - } + } } foreach (var number2 in numbers2) Console.WriteLine(number2); diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.conversion/cs/convert1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.conversion/cs/convert1.cs index 1828b3fda71cd..b643c48571379 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.conversion/cs/convert1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.conversion/cs/convert1.cs @@ -10,71 +10,71 @@ public static void Main() } private static void PerformConversions() - { + { // // Convert an Int32 value to a Decimal (a widening conversion). int integralValue = 12534; decimal decimalValue = Convert.ToDecimal(integralValue); - Console.WriteLine("Converted the {0} value {1} to " + - "the {2} value {3:N2}.", - integralValue.GetType().Name, - integralValue, - decimalValue.GetType().Name, + Console.WriteLine("Converted the {0} value {1} to " + + "the {2} value {3:N2}.", + integralValue.GetType().Name, + integralValue, + decimalValue.GetType().Name, decimalValue); // Convert a Byte value to an Int32 value (a widening conversion). byte byteValue = Byte.MaxValue; - int integralValue2 = Convert.ToInt32(byteValue); - Console.WriteLine("Converted the {0} value {1} to " + - "the {2} value {3:G}.", - byteValue.GetType().Name, - byteValue, - integralValue2.GetType().Name, + int integralValue2 = Convert.ToInt32(byteValue); + Console.WriteLine("Converted the {0} value {1} to " + + "the {2} value {3:G}.", + byteValue.GetType().Name, + byteValue, + integralValue2.GetType().Name, integralValue2); // Convert a Double value to an Int32 value (a narrowing conversion). double doubleValue = 16.32513e12; try { long longValue = Convert.ToInt64(doubleValue); - Console.WriteLine("Converted the {0} value {1:E} to " + - "the {2} value {3:N0}.", - doubleValue.GetType().Name, - doubleValue, - longValue.GetType().Name, + Console.WriteLine("Converted the {0} value {1:E} to " + + "the {2} value {3:N0}.", + doubleValue.GetType().Name, + doubleValue, + longValue.GetType().Name, longValue); } catch (OverflowException) { - Console.WriteLine("Unable to convert the {0:E} value {1}.", + Console.WriteLine("Unable to convert the {0:E} value {1}.", doubleValue.GetType().Name, doubleValue); } - - // Convert a signed byte to a byte (a narrowing conversion). + + // Convert a signed byte to a byte (a narrowing conversion). sbyte sbyteValue = -16; try { byte byteValue2 = Convert.ToByte(sbyteValue); - Console.WriteLine("Converted the {0} value {1} to " + - "the {2} value {3:G}.", - sbyteValue.GetType().Name, - sbyteValue, - byteValue2.GetType().Name, + Console.WriteLine("Converted the {0} value {1} to " + + "the {2} value {3:G}.", + sbyteValue.GetType().Name, + sbyteValue, + byteValue2.GetType().Name, byteValue2); } catch (OverflowException) { - Console.WriteLine("Unable to convert the {0} value {1}.", + Console.WriteLine("Unable to convert the {0} value {1}.", sbyteValue.GetType().Name, sbyteValue); - } + } // The example displays the following output: // Converted the Int32 value 12534 to the Decimal value 12,534.00. // Converted the Byte value 255 to the Int32 value 255. // Converted the Double value 1.632513E+013 to the Int64 value 16,325,130,000,000. - // Unable to convert the SByte value -16. - // + // Unable to convert the SByte value -16. + // } private static void LosePrecision() { // - double doubleValue; - + double doubleValue; + // Convert a Double to a Decimal. decimal decimalValue = 13956810.96702888123451471211m; doubleValue = Convert.ToDouble(decimalValue); @@ -83,13 +83,13 @@ private static void LosePrecision() doubleValue = 42.72; try { int integerValue = Convert.ToInt32(doubleValue); - Console.WriteLine("{0} converted to {1}.", + Console.WriteLine("{0} converted to {1}.", doubleValue, integerValue); } - catch (OverflowException) { - Console.WriteLine("Unable to convert {0} to an integer.", + catch (OverflowException) { + Console.WriteLine("Unable to convert {0} to an integer.", doubleValue); - } + } // The example displays the following output: // 13956810.96702888123451471211 converted to 13956810.9670289. // 42.72 converted to 43. diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.conversion/cs/explicit1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.conversion/cs/explicit1.cs index 5621952ae4b82..229cdcba4e102 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.conversion/cs/explicit1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.conversion/cs/explicit1.cs @@ -19,38 +19,38 @@ private static void PerformIntegerConversion() ulong number3 = int.MaxValue; int intNumber; - + try { intNumber = checked((int) number1); - Console.WriteLine("After assigning a {0} value, the Integer value is {1}.", - number1.GetType().Name, intNumber); + Console.WriteLine("After assigning a {0} value, the Integer value is {1}.", + number1.GetType().Name, intNumber); } catch (OverflowException) { if (number1 > int.MaxValue) - Console.WriteLine("Conversion failed: {0} exceeds {1}.", + Console.WriteLine("Conversion failed: {0} exceeds {1}.", number1, int.MaxValue); else - Console.WriteLine("Conversion failed: {0} is less than {1}.", + Console.WriteLine("Conversion failed: {0} is less than {1}.", number1, int.MinValue); } try { intNumber = checked((int) number2); - Console.WriteLine("After assigning a {0} value, the Integer value is {1}.", - number2.GetType().Name, intNumber); + Console.WriteLine("After assigning a {0} value, the Integer value is {1}.", + number2.GetType().Name, intNumber); } catch (OverflowException) { - Console.WriteLine("Conversion failed: {0} exceeds {1}.", + Console.WriteLine("Conversion failed: {0} exceeds {1}.", number2, int.MaxValue); } try { intNumber = checked((int) number3); - Console.WriteLine("After assigning a {0} value, the Integer value is {1}.", - number3.GetType().Name, intNumber); + Console.WriteLine("After assigning a {0} value, the Integer value is {1}.", + number3.GetType().Name, intNumber); } catch (OverflowException) { - Console.WriteLine("Conversion failed: {0} exceeds {1}.", + Console.WriteLine("Conversion failed: {0} exceeds {1}.", number1, int.MaxValue); } @@ -65,7 +65,7 @@ private static void PerformCustomConversion() { // ByteWithSign value; - + try { int intValue = -120; value = (ByteWithSign) intValue; @@ -74,7 +74,7 @@ private static void PerformCustomConversion() catch (OverflowException e) { Console.WriteLine(e.Message); } - + try { uint uintValue = 1024; value = (ByteWithSign) uintValue; @@ -86,7 +86,7 @@ private static void PerformCustomConversion() // The example displays the following output: // -120 // '1024' is out of range of the ByteWithSign data type. - // + // } private static void CheckedAndUnchecked() @@ -94,61 +94,61 @@ private static void CheckedAndUnchecked() // int largeValue = Int32.MaxValue; byte newValue; - + try { newValue = unchecked((byte) largeValue); - Console.WriteLine("Converted the {0} value {1} to the {2} value {3}.", + Console.WriteLine("Converted the {0} value {1} to the {2} value {3}.", largeValue.GetType().Name, largeValue, newValue.GetType().Name, newValue); } catch (OverflowException) { - Console.WriteLine("{0} is outside the range of the Byte data type.", + Console.WriteLine("{0} is outside the range of the Byte data type.", largeValue); } - + try { newValue = checked((byte) largeValue); - Console.WriteLine("Converted the {0} value {1} to the {2} value {3}.", + Console.WriteLine("Converted the {0} value {1} to the {2} value {3}.", largeValue.GetType().Name, largeValue, newValue.GetType().Name, newValue); } catch (OverflowException) { - Console.WriteLine("{0} is outside the range of the Byte data type.", + Console.WriteLine("{0} is outside the range of the Byte data type.", largeValue); } // The example displays the following output: // Converted the Int32 value 2147483647 to the Byte value 255. // 2147483647 is outside the range of the Byte data type. - // + // } } // public struct ByteWithSign { - private SByte signValue; + private SByte signValue; private Byte value; private const byte MaxValue = byte.MaxValue; private const int MinValue = -1 * byte.MaxValue; - - public static explicit operator ByteWithSign(int value) + + public static explicit operator ByteWithSign(int value) { // Check for overflow. if (value > ByteWithSign.MaxValue || value < ByteWithSign.MinValue) - throw new OverflowException(String.Format("'{0}' is out of range of the ByteWithSign data type.", + throw new OverflowException(String.Format("'{0}' is out of range of the ByteWithSign data type.", value)); - + ByteWithSign newValue; newValue.signValue = (SByte) Math.Sign(value); newValue.value = (byte) Math.Abs(value); return newValue; - } - + } + public static explicit operator ByteWithSign(uint value) { - if (value > ByteWithSign.MaxValue) - throw new OverflowException(String.Format("'{0}' is out of range of the ByteWithSign data type.", + if (value > ByteWithSign.MaxValue) + throw new OverflowException(String.Format("'{0}' is out of range of the ByteWithSign data type.", value)); ByteWithSign newValue; @@ -156,9 +156,9 @@ public static explicit operator ByteWithSign(uint value) newValue.value = (byte) value; return newValue; } - + public override string ToString() - { + { return (signValue * value).ToString(); } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.conversion/cs/iconvertible1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.conversion/cs/iconvertible1.cs index 77ccb0d5ab3c1..8b45cc715e1aa 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.conversion/cs/iconvertible1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.conversion/cs/iconvertible1.cs @@ -9,7 +9,7 @@ public static void Main() } private static void CallEII() - { + { // int codePoint = 1067; IConvertible iConv = codePoint; diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.conversion/cs/iconvertible2.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.conversion/cs/iconvertible2.cs index 62e517fa89c9b..db30b983eab73 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.conversion/cs/iconvertible2.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.conversion/cs/iconvertible2.cs @@ -4,16 +4,16 @@ public abstract class Temperature : IConvertible { protected decimal temp; - + public Temperature(decimal temperature) { this.temp = temperature; } public decimal Value - { - get { return this.temp; } - set { this.temp = value; } + { + get { return this.temp; } + set { this.temp = value; } } public override string ToString() @@ -22,14 +22,14 @@ public override string ToString() } // IConvertible implementations. - public TypeCode GetTypeCode() { + public TypeCode GetTypeCode() { return TypeCode.Object; - } + } public bool ToBoolean(IFormatProvider provider) { throw new InvalidCastException(String.Format("Temperature-to-Boolean conversion is not supported.")); } - + public byte ToByte(IFormatProvider provider) { if (temp < Byte.MinValue || temp > Byte.MaxValue) throw new OverflowException(String.Format("{0} is out of range of the Byte data type.", temp)); @@ -40,19 +40,19 @@ public byte ToByte(IFormatProvider provider) { public char ToChar(IFormatProvider provider) { throw new InvalidCastException("Temperature-to-Char conversion is not supported."); } - + public DateTime ToDateTime(IFormatProvider provider) { throw new InvalidCastException("Temperature-to-DateTime conversion is not supported."); } - + public decimal ToDecimal(IFormatProvider provider) { return temp; } - + public double ToDouble(IFormatProvider provider) { return (double) temp; } - + public short ToInt16(IFormatProvider provider) { if (temp < Int16.MinValue || temp > Int16.MaxValue) throw new OverflowException(String.Format("{0} is out of range of the Int16 data type.", temp)); @@ -66,14 +66,14 @@ public int ToInt32(IFormatProvider provider) { else return (int) Math.Round(temp); } - + public long ToInt64(IFormatProvider provider) { if (temp < Int64.MinValue || temp > Int64.MaxValue) throw new OverflowException(String.Format("{0} is out of range of the Int64 data type.", temp)); else return (long) Math.Round(temp); } - + public sbyte ToSByte(IFormatProvider provider) { if (temp < SByte.MinValue || temp > SByte.MaxValue) throw new OverflowException(String.Format("{0} is out of range of the SByte data type.", temp)); @@ -84,11 +84,11 @@ public sbyte ToSByte(IFormatProvider provider) { public float ToSingle(IFormatProvider provider) { return (float) temp; } - + public virtual string ToString(IFormatProvider provider) { return temp.ToString(provider) + "°"; } - + // If conversionType is implemented by another IConvertible method, call it. public virtual object ToType(Type conversionType, IFormatProvider provider) { switch (Type.GetTypeCode(conversionType)) @@ -115,7 +115,7 @@ public virtual object ToType(Type conversionType, IFormatProvider provider) { return this.ToInt64(provider); case TypeCode.Object: // Leave conversion of non-base types to derived classes. - throw new InvalidCastException(String.Format("Cannot convert from Temperature to {0}.", + throw new InvalidCastException(String.Format("Cannot convert from Temperature to {0}.", conversionType.Name)); case TypeCode.SByte: return this.ToSByte(provider); @@ -134,21 +134,21 @@ public virtual object ToType(Type conversionType, IFormatProvider provider) { throw new InvalidCastException("Conversion not supported."); } } - + public ushort ToUInt16(IFormatProvider provider) { if (temp < UInt16.MinValue || temp > UInt16.MaxValue) throw new OverflowException(String.Format("{0} is out of range of the UInt16 data type.", temp)); else return (ushort) Math.Round(temp); } - + public uint ToUInt32(IFormatProvider provider) { if (temp < UInt32.MinValue || temp > UInt32.MaxValue) throw new OverflowException(String.Format("{0} is out of range of the UInt32 data type.", temp)); else return (uint) Math.Round(temp); } - + public ulong ToUInt64(IFormatProvider provider) { if (temp < UInt64.MinValue || temp > UInt64.MaxValue) throw new OverflowException(String.Format("{0} is out of range of the UInt64 data type.", temp)); @@ -162,7 +162,7 @@ public class TemperatureCelsius : Temperature, IConvertible public TemperatureCelsius(decimal value) : base(value) { } - + // Override ToString methods. public override string ToString() { @@ -171,34 +171,34 @@ public override string ToString() public override string ToString(IFormatProvider provider) { - return temp.ToString(provider) + "°C"; + return temp.ToString(provider) + "°C"; } - + // If conversionType is a implemented by another IConvertible method, call it. public override object ToType(Type conversionType, IFormatProvider provider) { // For non-objects, call base method. if (Type.GetTypeCode(conversionType) != TypeCode.Object) { return base.ToType(conversionType, provider); - } + } else - { + { if (conversionType.Equals(typeof(TemperatureCelsius))) return this; else if (conversionType.Equals(typeof(TemperatureFahrenheit))) return new TemperatureFahrenheit((decimal) this.temp * 9 / 5 + 32); else - throw new InvalidCastException(String.Format("Cannot convert from Temperature to {0}.", + throw new InvalidCastException(String.Format("Cannot convert from Temperature to {0}.", conversionType.Name)); } } } -public class TemperatureFahrenheit : Temperature, IConvertible +public class TemperatureFahrenheit : Temperature, IConvertible { public TemperatureFahrenheit(decimal value) : base(value) { } - + // Override ToString methods. public override string ToString() { @@ -207,29 +207,29 @@ public override string ToString() public override string ToString(IFormatProvider provider) { - return temp.ToString(provider) + "°F"; + return temp.ToString(provider) + "°F"; } public override object ToType(Type conversionType, IFormatProvider provider) - { + { // For non-objects, call base methood. if (Type.GetTypeCode(conversionType) != TypeCode.Object) { return base.ToType(conversionType, provider); - } + } else - { + { // Handle conversion between derived classes. - if (conversionType.Equals(typeof(TemperatureFahrenheit))) + if (conversionType.Equals(typeof(TemperatureFahrenheit))) return this; else if (conversionType.Equals(typeof(TemperatureCelsius))) return new TemperatureCelsius((decimal) (this.temp - 32) * 5 / 9); // Unspecified object type: throw an InvalidCastException. else - throw new InvalidCastException(String.Format("Cannot convert from Temperature to {0}.", + throw new InvalidCastException(String.Format("Cannot convert from Temperature to {0}.", conversionType.Name)); - } + } } -} +} // public class Example diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.conversion/cs/implicit1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.conversion/cs/implicit1.cs index 6408105f77606..137db0731b019 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.conversion/cs/implicit1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.conversion/cs/implicit1.cs @@ -17,28 +17,28 @@ private static void PerformDecimalConversions() int intValue = -1034000; long longValue = 1152921504606846976; ulong ulongValue = UInt64.MaxValue; - + decimal decimalValue; - + decimalValue = byteValue; - Console.WriteLine("After assigning a {0} value, the Decimal value is {1}.", - byteValue.GetType().Name, decimalValue); - + Console.WriteLine("After assigning a {0} value, the Decimal value is {1}.", + byteValue.GetType().Name, decimalValue); + decimalValue = shortValue; - Console.WriteLine("After assigning a {0} value, the Decimal value is {1}.", - shortValue.GetType().Name, decimalValue); + Console.WriteLine("After assigning a {0} value, the Decimal value is {1}.", + shortValue.GetType().Name, decimalValue); decimalValue = intValue; - Console.WriteLine("After assigning a {0} value, the Decimal value is {1}.", - intValue.GetType().Name, decimalValue); + Console.WriteLine("After assigning a {0} value, the Decimal value is {1}.", + intValue.GetType().Name, decimalValue); decimalValue = longValue; - Console.WriteLine("After assigning a {0} value, the Decimal value is {1}.", - longValue.GetType().Name, decimalValue); - + Console.WriteLine("After assigning a {0} value, the Decimal value is {1}.", + longValue.GetType().Name, decimalValue); + decimalValue = ulongValue; - Console.WriteLine("After assigning a {0} value, the Decimal value is {1}.", - longValue.GetType().Name, decimalValue); + Console.WriteLine("After assigning a {0} value, the Decimal value is {1}.", + longValue.GetType().Name, decimalValue); // The example displays the following output: // After assigning a Byte value, the Decimal value is 16. // After assigning a Int16 value, the Decimal value is -1024. @@ -59,24 +59,24 @@ private static void PerformCustomConversions() // The example displays the following output: // -120 // 255 - // + // } } // public struct ByteWithSign { - private SByte signValue; + private SByte signValue; private Byte value; - - public static implicit operator ByteWithSign(SByte value) + + public static implicit operator ByteWithSign(SByte value) { ByteWithSign newValue; newValue.signValue = (SByte) Math.Sign(value); newValue.value = (byte) Math.Abs(value); return newValue; - } - + } + public static implicit operator ByteWithSign(Byte value) { ByteWithSign newValue; @@ -84,9 +84,9 @@ public static implicit operator ByteWithSign(Byte value) newValue.value = value; return newValue; } - + public override string ToString() - { + { return (signValue * value).ToString(); } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.crosslanguage/cs/numberutil.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.crosslanguage/cs/numberutil.cs index 0b827cc5eb385..9bf4973a8c00c 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.crosslanguage/cs/numberutil.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.crosslanguage/cs/numberutil.cs @@ -1,15 +1,15 @@ // using System; -public static class NumericLib +public static class NumericLib { public static bool IsEven(this IConvertible number) { if (number is Byte || number is SByte || number is Int16 || - number is UInt16 || - number is Int32 || + number is UInt16 || + number is Int32 || number is UInt32 || number is Int64) return Convert.ToInt64(number) % 2 == 0; @@ -18,10 +18,10 @@ number is UInt32 || else throw new NotSupportedException("IsEven called for a non-integer value."); } - + public static bool NearZero(double number) { - return Math.Abs(number) < .00001; + return Math.Abs(number) < .00001; } } // diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.crosslanguage/cs/useutilities1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.crosslanguage/cs/useutilities1.cs index ba56f407d52c2..68b1683d1d330 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.crosslanguage/cs/useutilities1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.crosslanguage/cs/useutilities1.cs @@ -11,7 +11,7 @@ public static void Main() { Double dbl = 0.0 - Double.Epsilon; Console.WriteLine(NumericLib.NearZero(dbl)); - + string s = "war and peace"; Console.WriteLine(s.ToTitleCase()); } @@ -21,15 +21,15 @@ public static void Main() // War and Peace // -public static class NumericLib +public static class NumericLib { public static bool IsEven(this IConvertible number) { if (number is Byte || number is SByte || number is Int16 || - number is UInt16 || - number is Int32 || + number is UInt16 || + number is Int32 || number is UInt32 || number is Int64) return ((long) number) % 2 == 0; @@ -38,40 +38,40 @@ number is UInt32 || else throw new NotSupportedException("IsEven called for a non-integer value."); } - + public static bool NearZero(double number) { - return number < .00001; + return number < .00001; } } public static class StringLib { - private static List exclusions; - + private static List exclusions; + static StringLib() { string[] words = { "a", "an", "and", "of", "the" }; exclusions = new List(); exclusions.AddRange(words); } - + public static string ToTitleCase(this string title) { - string[] words = title.Split(); + string[] words = title.Split(); string result = String.Empty; - + for (int ctr = 0; ctr < words.Length; ctr++) { string word = words[ctr]; if (ctr == 0 || !(exclusions.Contains(word.ToLower()))) - result += word.Substring(0, 1).ToUpper() + + result += word.Substring(0, 1).ToUpper() + word.Substring(1).ToLower(); else result += word.ToLower(); if (ctr <= words.Length - 1) - result += " "; - } - return result; + result += " "; + } + return result; } } \ No newline at end of file diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.disposable/cs/base1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.disposable/cs/base1.cs index fe7e74bb5862e..87f4bdf2c1fc1 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.disposable/cs/base1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.disposable/cs/base1.cs @@ -13,31 +13,31 @@ public class DisposableStreamResource : IDisposable protected const uint FILE_ATTRIBUTE_NORMAL = 0x80; protected IntPtr INVALID_HANDLE_VALUE = new IntPtr(-1); private const int INVALID_FILE_SIZE = unchecked((int) 0xFFFFFFFF); - + // Define Windows APIs. [DllImport("kernel32.dll", EntryPoint = "CreateFileW", CharSet = CharSet.Unicode)] protected static extern IntPtr CreateFile ( - string lpFileName, uint dwDesiredAccess, - uint dwShareMode, IntPtr lpSecurityAttributes, - uint dwCreationDisposition, uint dwFlagsAndAttributes, + string lpFileName, uint dwDesiredAccess, + uint dwShareMode, IntPtr lpSecurityAttributes, + uint dwCreationDisposition, uint dwFlagsAndAttributes, IntPtr hTemplateFile); - + [DllImport("kernel32.dll")] private static extern int GetFileSize(SafeFileHandle hFile, out int lpFileSizeHigh); - + // Define locals. private bool disposed = false; - private SafeFileHandle safeHandle; + private SafeFileHandle safeHandle; private long bufferSize; private int upperWord; - + public DisposableStreamResource(string filename) { if (filename == null) throw new ArgumentNullException("The filename cannot be null."); else if (filename == "") throw new ArgumentException("The filename cannot be an empty string."); - + IntPtr handle = CreateFile(filename, GENERIC_READ, FILE_SHARE_READ, IntPtr.Zero, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, IntPtr.Zero); @@ -45,23 +45,23 @@ public DisposableStreamResource(string filename) safeHandle = new SafeFileHandle(handle, true); else throw new FileNotFoundException(String.Format("Cannot open '{0}'", filename)); - + // Get file size. - bufferSize = GetFileSize(safeHandle, out upperWord); + bufferSize = GetFileSize(safeHandle, out upperWord); if (bufferSize == INVALID_FILE_SIZE) bufferSize = -1; - else if (upperWord > 0) + else if (upperWord > 0) bufferSize = (((long)upperWord) << 32) + bufferSize; } - - public long Size + + public long Size { get { return bufferSize; } } public void Dispose() { Dispose(true); GC.SuppressFinalize(this); - } + } protected virtual void Dispose(bool disposing) { @@ -70,11 +70,11 @@ protected virtual void Dispose(bool disposing) // Dispose of managed resources here. if (disposing) safeHandle.Dispose(); - + // Dispose of any unmanaged resources not wrapped in safe handles. - + disposed = true; - } + } } // diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.disposable/cs/derived1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.disposable/cs/derived1.cs index 4c2118c79f932..5116382345ed1 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.disposable/cs/derived1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.disposable/cs/derived1.cs @@ -8,32 +8,32 @@ public class DisposableStreamResource2 : DisposableStreamResource { // Define additional constants. - protected const uint GENERIC_WRITE = 0x40000000; + protected const uint GENERIC_WRITE = 0x40000000; protected const uint OPEN_ALWAYS = 4; - + // Define additional APIs. - [DllImport("kernel32.dll")] + [DllImport("kernel32.dll")] protected static extern bool WriteFile( - SafeFileHandle safeHandle, string lpBuffer, + SafeFileHandle safeHandle, string lpBuffer, int nNumberOfBytesToWrite, out int lpNumberOfBytesWritten, IntPtr lpOverlapped); - + // Define locals. private bool disposed = false; private string filename; private bool created = false; private SafeFileHandle safeHandle; - + public DisposableStreamResource2(string filename) : base(filename) { this.filename = filename; } - + public void WriteFileInfo() - { + { if (! created) { - IntPtr hFile = CreateFile(@".\FileInfo.txt", GENERIC_WRITE, 0, - IntPtr.Zero, OPEN_ALWAYS, + IntPtr hFile = CreateFile(@".\FileInfo.txt", GENERIC_WRITE, 0, + IntPtr.Zero, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, IntPtr.Zero); if (hFile != INVALID_HANDLE_VALUE) safeHandle = new SafeFileHandle(hFile, true); @@ -45,21 +45,21 @@ public void WriteFileInfo() string output = String.Format("{0}: {1:N0} bytes\n", filename, Size); int bytesWritten; - bool result = WriteFile(safeHandle, output, output.Length, out bytesWritten, IntPtr.Zero); + bool result = WriteFile(safeHandle, output, output.Length, out bytesWritten, IntPtr.Zero); } protected override void Dispose(bool disposing) { if (disposed) return; - + // Release any managed resources here. if (disposing) safeHandle.Dispose(); - + disposed = true; - + // Release any unmanaged resources not wrapped by safe handles here. - + // Call the base class implementation. base.Dispose(disposing); } @@ -85,31 +85,31 @@ public class DisposableStreamResource : IDisposable protected const uint FILE_ATTRIBUTE_NORMAL = 0x80; protected IntPtr INVALID_HANDLE_VALUE = new IntPtr(-1); private const int INVALID_FILE_SIZE = unchecked((int) 0xFFFFFFFF); - + // Define Windows APIs. [DllImport("kernel32.dll", EntryPoint = "CreateFileW", CharSet = CharSet.Unicode)] protected static extern IntPtr CreateFile ( - string lpFileName, uint dwDesiredAccess, - uint dwShareMode, IntPtr lpSecurityAttributes, - uint dwCreationDisposition, uint dwFlagsAndAttributes, + string lpFileName, uint dwDesiredAccess, + uint dwShareMode, IntPtr lpSecurityAttributes, + uint dwCreationDisposition, uint dwFlagsAndAttributes, IntPtr hTemplateFile); - + [DllImport("kernel32.dll")] private static extern int GetFileSize(SafeFileHandle hFile, out int lpFileSizeHigh); - + // Define locals. private bool disposed = false; - private SafeFileHandle safeHandle; + private SafeFileHandle safeHandle; private long bufferSize; private int upperWord; - + public DisposableStreamResource(string filename) { if (filename == null) throw new ArgumentNullException("The filename cannot be null."); else if (filename == "") throw new ArgumentException("The filename cannot be an empty string."); - + IntPtr handle = CreateFile(filename, GENERIC_READ, FILE_SHARE_READ, IntPtr.Zero, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, IntPtr.Zero); @@ -117,23 +117,23 @@ public DisposableStreamResource(string filename) safeHandle = new SafeFileHandle(handle, true); else throw new FileNotFoundException(String.Format("Cannot open '{0}'", filename)); - + // Get file size. - bufferSize = GetFileSize(safeHandle, out upperWord); + bufferSize = GetFileSize(safeHandle, out upperWord); if (bufferSize == INVALID_FILE_SIZE) bufferSize = -1; - else if (upperWord > 0) + else if (upperWord > 0) bufferSize = (((long)upperWord) << 32) + bufferSize; } - - public long Size + + public long Size { get { return bufferSize; } } public void Dispose() { Dispose(true); GC.SuppressFinalize(this); - } + } protected virtual void Dispose(bool disposing) { @@ -142,9 +142,9 @@ protected virtual void Dispose(bool disposing) // Dispose of managed resources here. if (disposing) safeHandle.Dispose(); - + // Dispose of any unmanaged resources not wrapped in safe handles. - + disposed = true; - } + } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.disposable/cs/dispose1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.disposable/cs/dispose1.cs index 8b48dcda697dc..9edf952a98d95 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.disposable/cs/dispose1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.disposable/cs/dispose1.cs @@ -17,7 +17,7 @@ public void Dispose() // Suppress finalization. GC.SuppressFinalize(this); } - // + // // protected virtual void Dispose(bool disposing) diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.disposable/cs/using1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.disposable/cs/using1.cs index faffc2b5acb40..42a73b930f6af 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.disposable/cs/using1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.disposable/cs/using1.cs @@ -13,7 +13,7 @@ public static void Main() charsRead = s.Read(buffer, 0, buffer.Length); // // Process characters read. - // + // } } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.disposable/cs/using2.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.disposable/cs/using2.cs index e6d6404669b06..26a234e773cd9 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.disposable/cs/using2.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.disposable/cs/using2.cs @@ -9,13 +9,13 @@ public static void Main() Char[] buffer = new Char[50]; StreamReader s = null; try { - s = new StreamReader("File1.txt"); + s = new StreamReader("File1.txt"); int charsRead = 0; while (s.Peek() != -1) { charsRead = s.Read(buffer, 0, buffer.Length); // // Process characters read. - // + // } } finally { diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.disposable/cs/using3.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.disposable/cs/using3.cs index 19c0feb4b8561..f9ff4ce4817be 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.disposable/cs/using3.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.disposable/cs/using3.cs @@ -8,20 +8,20 @@ public static void Main() { Char[] buffer = new Char[50]; { - StreamReader s = new StreamReader("File1.txt"); + StreamReader s = new StreamReader("File1.txt"); try { int charsRead = 0; while (s.Peek() != -1) { charsRead = s.Read(buffer, 0, buffer.Length); // // Process characters read. - // + // } } finally { if (s != null) - ((IDisposable)s).Dispose(); - } + ((IDisposable)s).Dispose(); + } } } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.disposable/cs/using4.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.disposable/cs/using4.cs index 5adade1554dc0..3ff3de3c90e9b 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.disposable/cs/using4.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.disposable/cs/using4.cs @@ -7,7 +7,7 @@ public class Example public static void Main() { Char[] buffer1 = new Char[50], buffer2 = new Char[50]; - + using (StreamReader version1 = new StreamReader("file1.txt"), version2 = new StreamReader("file2.txt")) { int charsRead1, charsRead2 = 0; diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.disposable/cs/using5.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.disposable/cs/using5.cs index aa84583e169c2..265d29d42db46 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.disposable/cs/using5.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.disposable/cs/using5.cs @@ -11,20 +11,20 @@ public static void Main() try { sr = new StreamReader("file1.txt"); String contents = sr.ReadToEnd(); - Console.WriteLine("The file has {0} text elements.", - new StringInfo(contents).LengthInTextElements); - } + Console.WriteLine("The file has {0} text elements.", + new StringInfo(contents).LengthInTextElements); + } catch (FileNotFoundException) { Console.WriteLine("The file cannot be found."); - } + } catch (IOException) { Console.WriteLine("An I/O error has occurred."); } catch (OutOfMemoryException) { - Console.WriteLine("There is insufficient memory to read the file."); + Console.WriteLine("There is insufficient memory to read the file."); } finally { - if (sr != null) sr.Dispose(); + if (sr != null) sr.Dispose(); } } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.encoding/cs/bestfit1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.encoding/cs/bestfit1.cs index 96f51e721b167..dd420dec2b548 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.encoding/cs/bestfit1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.encoding/cs/bestfit1.cs @@ -8,7 +8,7 @@ public static void Main() { // Get an encoding for code page 1252 (Western Europe character set). Encoding cp1252 = Encoding.GetEncoding(1252); - + // Define and display a string. string str = "\u24c8 \u2075 \u221e"; Console.WriteLine("Original string: " + str); @@ -16,15 +16,15 @@ public static void Main() foreach (var ch in str) Console.Write("{0} ", Convert.ToUInt16(ch).ToString("X4")); - Console.WriteLine("\n"); - + Console.WriteLine("\n"); + // Encode a Unicode string. Byte[] bytes = cp1252.GetBytes(str); Console.Write("Encoded bytes: "); foreach (byte byt in bytes) Console.Write("{0:X2} ", byt); Console.WriteLine("\n"); - + // Decode the string. string str2 = cp1252.GetString(bytes); Console.WriteLine("String round-tripped: {0}", str.Equals(str2)); @@ -38,9 +38,9 @@ public static void Main() // The example displays the following output: // Original string: Ⓢ ⁵ ∞ // Code points in string: 24C8 0020 2075 0020 221E -// +// // Encoded bytes: 3F 20 35 20 38 -// +// // String round-tripped: False // ? 5 8 // 003F 0020 0035 0020 0038 diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.encoding/cs/bestfit1a.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.encoding/cs/bestfit1a.cs index d029e1e530ef7..f13ce43187d0e 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.encoding/cs/bestfit1a.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.encoding/cs/bestfit1a.cs @@ -6,10 +6,10 @@ public class Example { public static void Main() { - Encoding cp1252r = Encoding.GetEncoding(1252, + Encoding cp1252r = Encoding.GetEncoding(1252, new EncoderReplacementFallback("*"), new DecoderReplacementFallback("*")); - + string str1 = "\u24C8 \u2075 \u221E"; Console.WriteLine(str1); foreach (var ch in str1) @@ -26,7 +26,7 @@ public static void Main() Console.Write("{0} ", Convert.ToUInt16(ch).ToString("X4")); Console.WriteLine(); - } + } } } // The example displays the following output: diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.encoding/cs/custom1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.encoding/cs/custom1.cs index 2f3ff32bddcaf..abc6ecde956e0 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.encoding/cs/custom1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.encoding/cs/custom1.cs @@ -13,7 +13,7 @@ static void Main() Console.WriteLine(str1); for (int ctr = 0; ctr <= str1.Length - 1; ctr++) { Console.Write("{0} ", Convert.ToUInt16(str1[ctr]).ToString("X4")); - if (ctr == str1.Length - 1) + if (ctr == str1.Length - 1) Console.WriteLine(); } Console.WriteLine(); @@ -47,9 +47,9 @@ public class CustomMapper : EncoderFallback internal Dictionary mapping; public CustomMapper() : this("*") - { + { } - + public CustomMapper(string defaultString) { this.DefaultString = defaultString; @@ -69,7 +69,7 @@ public override EncoderFallbackBuffer CreateFallbackBuffer() public override int MaxCharCount { get { return 3; } - } + } } // @@ -78,8 +78,8 @@ public class CustomMapperFallbackBuffer : EncoderFallbackBuffer { int count = -1; // Number of characters to return int index = -1; // Index of character to return - CustomMapper fb; - string charsToReturn; + CustomMapper fb; + string charsToReturn; public CustomMapperFallbackBuffer(CustomMapper fallback) { @@ -127,7 +127,7 @@ public override char GetNextChar() // We'll return a character if possible, so subtract from the count of chars to return. count--; // If count is less than zero, we've returned all characters. - if (count < 0) + if (count < 0) return '\u0000'; this.index--; @@ -146,7 +146,7 @@ public override bool MovePrevious() } } - public override int Remaining + public override int Remaining { get { return count < 0 ? 0 : count; } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.encoding/cs/exceptionascii.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.encoding/cs/exceptionascii.cs index 1b53ec92a6fb7..79846c8e27952 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.encoding/cs/exceptionascii.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.encoding/cs/exceptionascii.cs @@ -6,10 +6,10 @@ public class Example { public static void Main() { - Encoding enc = Encoding.GetEncoding("us-ascii", - new EncoderExceptionFallback(), + Encoding enc = Encoding.GetEncoding("us-ascii", + new EncoderExceptionFallback(), new DecoderExceptionFallback()); - + string str1 = "\u24C8 \u2075 \u221E"; Console.WriteLine(str1); foreach (var ch in str1) @@ -30,13 +30,13 @@ public static void Main() catch (EncoderFallbackException e) { Console.Write("Exception: "); if (e.IsUnknownSurrogate()) - Console.WriteLine("Unable to encode surrogate pair 0x{0:X4} 0x{1:X3} at index {2}.", - Convert.ToUInt16(e.CharUnknownHigh), - Convert.ToUInt16(e.CharUnknownLow), + Console.WriteLine("Unable to encode surrogate pair 0x{0:X4} 0x{1:X3} at index {2}.", + Convert.ToUInt16(e.CharUnknownHigh), + Convert.ToUInt16(e.CharUnknownLow), e.Index); else - Console.WriteLine("Unable to encode 0x{0:X4} at index {1}.", - Convert.ToUInt16(e.CharUnknown), + Console.WriteLine("Unable to encode 0x{0:X4} at index {1}.", + Convert.ToUInt16(e.CharUnknown), e.Index); return; } @@ -52,7 +52,7 @@ public static void Main() Console.Write("{0} ", Convert.ToUInt16(ch).ToString("X4")); Console.WriteLine(); - } + } } catch (DecoderFallbackException e) { Console.Write("Unable to decode byte(s) "); @@ -66,6 +66,6 @@ public static void Main() // The example displays the following output: // Ⓢ ⁵ ∞ // 24C8 0020 2075 0020 221E -// +// // Exception: Unable to encode 0x24C8 at index 0. // diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.encoding/cs/getbytes1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.encoding/cs/getbytes1.cs index 735719d471c6d..96b3e14d4bd46 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.encoding/cs/getbytes1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.encoding/cs/getbytes1.cs @@ -6,39 +6,39 @@ public class Example { public static void Main() { - string[] strings= { "This is the first sentence. ", + string[] strings= { "This is the first sentence. ", "This is the second sentence. " }; Encoding asciiEncoding = Encoding.ASCII; - + // Create array of adequate size. byte[] bytes = new byte[49]; // Create index for current position of array. int index = 0; - + Console.WriteLine("Strings to encode:"); foreach (var stringValue in strings) { Console.WriteLine(" {0}", stringValue); - + int count = asciiEncoding.GetByteCount(stringValue); if (count + index >= bytes.Length) Array.Resize(ref bytes, bytes.Length + 50); - int written = asciiEncoding.GetBytes(stringValue, 0, - stringValue.Length, - bytes, index); - - index = index + written; - } + int written = asciiEncoding.GetBytes(stringValue, 0, + stringValue.Length, + bytes, index); + + index = index + written; + } Console.WriteLine("\nEncoded bytes:"); Console.WriteLine("{0}", ShowByteValues(bytes, index)); Console.WriteLine(); - + // Decode Unicode byte array to a string. string newString = asciiEncoding.GetString(bytes, 0, index); Console.WriteLine("Decoded: {0}", newString); } - - private static string ShowByteValues(byte[] bytes, int last ) + + private static string ShowByteValues(byte[] bytes, int last ) { string returnString = " "; for (int ctr = 0; ctr <= last - 1; ctr++) { @@ -53,12 +53,12 @@ private static string ShowByteValues(byte[] bytes, int last ) // Strings to encode: // This is the first sentence. // This is the second sentence. -// +// // Encoded bytes: -// +// // 54 68 69 73 20 69 73 20 74 68 65 20 66 69 72 73 74 20 73 65 // 6E 74 65 6E 63 65 2E 20 54 68 69 73 20 69 73 20 74 68 65 20 // 73 65 63 6F 6E 64 20 73 65 6E 74 65 6E 63 65 2E 20 -// +// // Decoded: This is the first sentence. This is the second sentence. // diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.encoding/cs/getchars1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.encoding/cs/getchars1.cs index aa29dbd0f5979..7f021b8493c26 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.encoding/cs/getchars1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.encoding/cs/getchars1.cs @@ -6,7 +6,7 @@ public class Example { public static void Main() { - string[] strings = { "This is the first sentence. ", + string[] strings = { "This is the first sentence. ", "This is the second sentence. ", "This is the third sentence. " }; Encoding asciiEncoding = Encoding.ASCII; @@ -15,8 +15,8 @@ public static void Main() // Array to hold decoded characters. char[] chars = new char[50]; // Create index for current position of character array. - int index = 0; - + int index = 0; + foreach (var stringValue in strings) { Console.WriteLine("String to Encode: {0}", stringValue); // Encode the string to a byte array. @@ -24,8 +24,8 @@ public static void Main() // Display the encoded bytes. Console.Write("Encoded bytes: "); for (int ctr = 0; ctr < bytes.Length; ctr++) - Console.Write(" {0}{1:X2}", - ctr % 20 == 0 ? Environment.NewLine : "", + Console.Write(" {0}{1:X2}", + ctr % 20 == 0 ? Environment.NewLine : "", bytes[ctr]); Console.WriteLine(); @@ -34,13 +34,13 @@ public static void Main() if (count + index >= chars.Length) Array.Resize(ref chars, chars.Length + 50); - int written = asciiEncoding.GetChars(bytes, 0, - bytes.Length, - chars, index); + int written = asciiEncoding.GetChars(bytes, 0, + bytes.Length, + chars, index); index = index + written; - Console.WriteLine(); + Console.WriteLine(); } - + // Instantiate a single string containing the characters. string decodedString = new string(chars, 0, index - 1); Console.WriteLine("Decoded string: "); @@ -52,17 +52,17 @@ public static void Main() // Encoded bytes: // 54 68 69 73 20 69 73 20 74 68 65 20 66 69 72 73 74 20 73 65 // 6E 74 65 6E 63 65 2E 20 -// +// // String to Encode: This is the second sentence. // Encoded bytes: // 54 68 69 73 20 69 73 20 74 68 65 20 73 65 63 6F 6E 64 20 73 // 65 6E 74 65 6E 63 65 2E 20 -// +// // String to Encode: This is the third sentence. // Encoded bytes: // 54 68 69 73 20 69 73 20 74 68 65 20 74 68 69 72 64 20 73 65 // 6E 74 65 6E 63 65 2E 20 -// +// // Decoded string: // This is the first sentence. This is the second sentence. This is the third sentence. // diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.encoding/cs/replacementascii.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.encoding/cs/replacementascii.cs index 44142193e9621..fb049b54b8337 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.encoding/cs/replacementascii.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.encoding/cs/replacementascii.cs @@ -7,7 +7,7 @@ public class Example public static void Main() { Encoding enc = Encoding.ASCII; - + string str1 = "\u24C8 \u2075 \u221E"; Console.WriteLine(str1); foreach (var ch in str1) @@ -31,15 +31,15 @@ public static void Main() Console.Write("{0} ", Convert.ToUInt16(ch).ToString("X4")); Console.WriteLine(); - } + } } } // The example displays the following output: // Ⓢ ⁵ ∞ // 24C8 0020 2075 0020 221E -// +// // Encoded bytes: 3F 20 3F 20 3F -// +// // Round-trip: False // ? ? ? // 003F 0020 003F 0020 003F diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.encoding/cs/stream1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.encoding/cs/stream1.cs index f76fd2dbc3fa3..841173f919307 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.encoding/cs/stream1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.encoding/cs/stream1.cs @@ -9,39 +9,39 @@ public static void Main() { // Use default replacement fallback for invalid encoding. UnicodeEncoding enc = new UnicodeEncoding(true, false, false); - + // Define a string with various Unicode characters. - string str1 = "AB YZ 19 \uD800\udc05 \u00e4"; - str1 += "Unicode characters. \u00a9 \u010C s \u0062\u0308"; + string str1 = "AB YZ 19 \uD800\udc05 \u00e4"; + str1 += "Unicode characters. \u00a9 \u010C s \u0062\u0308"; Console.WriteLine("Created original string...\n"); - - // Convert string to byte array. + + // Convert string to byte array. byte[] bytes = enc.GetBytes(str1); - + FileStream fs = File.Create(@".\characters.bin"); BinaryWriter bw = new BinaryWriter(fs); bw.Write(bytes); bw.Close(); - + // Read bytes from file. FileStream fsIn = File.OpenRead(@".\characters.bin"); BinaryReader br = new BinaryReader(fsIn); - - const int count = 10; // Number of bytes to read at a time. + + const int count = 10; // Number of bytes to read at a time. byte[] bytesRead = new byte[10]; // Buffer (byte array). - int read; // Number of bytes actually read. + int read; // Number of bytes actually read. string str2 = String.Empty; // Decoded string. // Try using Encoding object for all operations. - do { + do { read = br.Read(bytesRead, 0, count); - str2 += enc.GetString(bytesRead, 0, read); + str2 += enc.GetString(bytesRead, 0, read); } while (read == count); br.Close(); Console.WriteLine("Decoded string using UnicodeEncoding.GetString()..."); CompareForEquality(str1, str2); Console.WriteLine(); - + // Use Decoder for all operations. fsIn = File.OpenRead(@".\characters.bin"); br = new BinaryReader(fsIn); @@ -49,32 +49,32 @@ public static void Main() char[] chars = new char[50]; int index = 0; // Next character to write in array. int written = 0; // Number of chars written to array. - do { + do { read = br.Read(bytesRead, 0, count); - if (index + decoder.GetCharCount(bytesRead, 0, read) - 1 >= chars.Length) + if (index + decoder.GetCharCount(bytesRead, 0, read) - 1 >= chars.Length) Array.Resize(ref chars, chars.Length + 50); written = decoder.GetChars(bytesRead, 0, read, chars, index); - index += written; + index += written; } while (read == count); - br.Close(); + br.Close(); // Instantiate a string with the decoded characters. - string str3 = new String(chars, 0, index); + string str3 = new String(chars, 0, index); Console.WriteLine("Decoded string using UnicodeEncoding.Decoder.GetString()..."); - CompareForEquality(str1, str3); + CompareForEquality(str1, str3); } private static void CompareForEquality(string original, string decoded) { bool result = original.Equals(decoded); - Console.WriteLine("original = decoded: {0}", + Console.WriteLine("original = decoded: {0}", original.Equals(decoded, StringComparison.Ordinal)); if (! result) { Console.WriteLine("Code points in original string:"); foreach (var ch in original) Console.Write("{0} ", Convert.ToUInt16(ch).ToString("X4")); Console.WriteLine(); - + Console.WriteLine("Code points in decoded string:"); foreach (var ch in decoded) Console.Write("{0} ", Convert.ToUInt16(ch).ToString("X4")); @@ -84,7 +84,7 @@ private static void CompareForEquality(string original, string decoded) } // The example displays the following output: // Created original string... -// +// // Decoded string using UnicodeEncoding.GetString()... // original = decoded: False // Code points in original string: @@ -95,7 +95,7 @@ private static void CompareForEquality(string original, string decoded) // 0041 0042 0020 0059 005A 0020 0031 0039 0020 FFFD FFFD 0020 00E4 0055 006E 0069 0063 006F // 0064 0065 0020 0063 0068 0061 0072 0061 0063 0074 0065 0072 0073 002E 0020 00A9 0020 010C // 0020 0073 0020 0062 0308 -// +// // Decoded string using UnicodeEncoding.Decoder.GetString()... // original = decoded: True // diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.events.other/cs/example.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.events.other/cs/example.cs index 3ba70cbb075d4..dc393f2004427 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.events.other/cs/example.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.events.other/cs/example.cs @@ -83,7 +83,7 @@ public bool SnoozePressed get {return snoozePressed;} set {snoozePressed = value;} } - + // The event member that is of type AlarmEventHandler. // public event AlarmEventHandler Alarm; diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.formatting.overview/cs/alias1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.formatting.overview/cs/alias1.cs index 27336aa6f3d96..22f214ce6dbc0 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.formatting.overview/cs/alias1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.formatting.overview/cs/alias1.cs @@ -9,7 +9,7 @@ public static void Main() DateTime date1 = new DateTime(2009, 6, 30); Console.WriteLine("D Format Specifier: {0:D}", date1); string longPattern = CultureInfo.CurrentCulture.DateTimeFormat.LongDatePattern; - Console.WriteLine("'{0}' custom format string: {1}", + Console.WriteLine("'{0}' custom format string: {1}", longPattern, date1.ToString(longPattern)); } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.formatting.overview/cs/appstandard1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.formatting.overview/cs/appstandard1.cs index 27f822dcdd6ca..d9c5250ffe2bb 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.formatting.overview/cs/appstandard1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.formatting.overview/cs/appstandard1.cs @@ -4,22 +4,22 @@ public class Temperature { private decimal m_Temp; - + public Temperature(decimal temperature) { this.m_Temp = temperature; } - + public decimal Celsius { get { return this.m_Temp; } } - + public decimal Kelvin { - get { return this.m_Temp + 273.15m; } + get { return this.m_Temp + 273.15m; } } - + public decimal Fahrenheit { get { return Math.Round(((decimal) (this.m_Temp * 9 / 5 + 32)), 2); } @@ -29,14 +29,14 @@ public override string ToString() { return this.ToString("C"); } - + public string ToString(string format) - { + { // Handle null or empty string. if (String.IsNullOrEmpty(format)) format = "C"; // Remove spaces and convert to uppercase. - format = format.Trim().ToUpperInvariant(); - + format = format.Trim().ToUpperInvariant(); + // Convert temperature to Fahrenheit and return string. switch (format) { @@ -52,7 +52,7 @@ public string ToString(string format) return this.Celsius.ToString("N2") + " °C"; default: throw new FormatException(String.Format("The '{0}' format string is not supported.", format)); - } + } } } @@ -80,7 +80,7 @@ public static void Main() Console.WriteLine(temp3.ToString("C")); Console.WriteLine(temp3.ToString("F")); Console.WriteLine(temp3.ToString("K")); - + Console.WriteLine(String.Format("The temperature is now {0:F}.", temp3)); } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.formatting.overview/cs/composite1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.formatting.overview/cs/composite1.cs index 051b7feb2ba0c..c6fce4240e07b 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.formatting.overview/cs/composite1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.formatting.overview/cs/composite1.cs @@ -10,33 +10,33 @@ public Product(string name) { this.productName = name; } - + public int Quantity { get { return this.onHand; } set { this.onHand = value; } } - + public decimal Price { get { return this.cost; } set { this.cost = value; } } - + public decimal Value { get { return this.cost * this.onHand; } } - + public string Name { get { return this.productName; } } - + public override string ToString() { return this.productName; - } + } } public class Example @@ -46,12 +46,12 @@ public static void Main() Product item1 = new Product("WidgetA"); item1.Quantity = 17; item1.Price = 6.32m; - DateTime thatDate = new DateTime(2009, 5, 1); + DateTime thatDate = new DateTime(2009, 5, 1); string result; // - result = String.Format("On {0:d}, the inventory of {1} was worth {2:C2}.", + result = String.Format("On {0:d}, the inventory of {1} was worth {2:C2}.", thatDate, item1, item1.Value); - Console.WriteLine(result); + Console.WriteLine(result); // The example displays output like the following if run on a system // whose current culture is en-US: // On 5/1/2009, the inventory of WidgetA was worth $107.44. diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.formatting.overview/cs/culturespecific1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.formatting.overview/cs/culturespecific1.cs index 64250aa1a3e85..2c2b1f5d5d811 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.formatting.overview/cs/culturespecific1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.formatting.overview/cs/culturespecific1.cs @@ -9,27 +9,27 @@ public static void Main() { string[] cultureNames = { "en-US", "fr-FR", "es-MX", "de-DE" }; DateTime dateToFormat = new DateTime(2012, 5, 28, 11, 30, 0); - + foreach (var cultureName in cultureNames) { // Change the current thread culture. Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(cultureName); - Console.WriteLine("The current culture is {0}", + Console.WriteLine("The current culture is {0}", Thread.CurrentThread.CurrentCulture.Name); Console.WriteLine(dateToFormat.ToString("F")); Console.WriteLine(); - } + } } } // The example displays the following output: // The current culture is en-US // Monday, May 28, 2012 11:30:00 AM -// +// // The current culture is fr-FR // lundi 28 mai 2012 11:30:00 -// +// // The current culture is es-MX // lunes, 28 de mayo de 2012 11:30:00 a.m. -// +// // The current culture is de-DE // Montag, 28. Mai 2012 11:30:00 // diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.formatting.overview/cs/culturespecific2.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.formatting.overview/cs/culturespecific2.cs index 2a957ead3cb5a..be6343dffbf03 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.formatting.overview/cs/culturespecific2.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.formatting.overview/cs/culturespecific2.cs @@ -5,14 +5,14 @@ public class Example { public static void Main() - { + { DateTime dat1 = new DateTime(2012, 5, 28, 11, 30, 0); string[] cultureNames = { "en-US", "en-GB", "ru", "fr" }; - + foreach (var name in cultureNames) { DateTimeFormatInfo dtfi = CultureInfo.CreateSpecificCulture(name).DateTimeFormat; Console.WriteLine("{0}: {1}", name, dat1.ToString(dtfi)); - } + } } } // The example displays the following output: diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.formatting.overview/cs/culturespecific3.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.formatting.overview/cs/culturespecific3.cs index e78e3ab63e1fa..f75186b3dcdaf 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.formatting.overview/cs/culturespecific3.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.formatting.overview/cs/culturespecific3.cs @@ -9,27 +9,27 @@ public static void Main() { string[] cultureNames = { "en-US", "fr-FR", "es-MX", "de-DE" }; Decimal value = 1043.17m; - + foreach (var cultureName in cultureNames) { // Change the current thread culture. Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(cultureName); - Console.WriteLine("The current culture is {0}", + Console.WriteLine("The current culture is {0}", Thread.CurrentThread.CurrentCulture.Name); Console.WriteLine(value.ToString("C2")); Console.WriteLine(); - } + } } } // The example displays the following output: // The current culture is en-US // $1,043.17 -// +// // The current culture is fr-FR // 1 043,17 € -// +// // The current culture is es-MX // $1,043.17 -// +// // The current culture is de-DE // 1.043,17 € // diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.formatting.overview/cs/culturespecific4.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.formatting.overview/cs/culturespecific4.cs index b72f51aae4e30..1c1c37c5b6101 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.formatting.overview/cs/culturespecific4.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.formatting.overview/cs/culturespecific4.cs @@ -5,14 +5,14 @@ public class Example { public static void Main() - { + { Double value = 1043.62957; string[] cultureNames = { "en-US", "en-GB", "ru", "fr" }; - + foreach (var name in cultureNames) { NumberFormatInfo nfi = CultureInfo.CreateSpecificCulture(name).NumberFormat; Console.WriteLine("{0,-6} {1}", name + ":", value.ToString("N3", nfi)); - } + } } } // The example displays the following output: diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.formatting.overview/cs/custom1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.formatting.overview/cs/custom1.cs index 7382c66531636..cd7c1cb456d23 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.formatting.overview/cs/custom1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.formatting.overview/cs/custom1.cs @@ -7,10 +7,10 @@ public static void Main() // string customFormat = "MMMM dd, yyyy (dddd)"; DateTime date1 = new DateTime(2009, 8, 28); - Console.WriteLine(date1.ToString(customFormat)); + Console.WriteLine(date1.ToString(customFormat)); // The example displays the following output if run on a system // whose language is English: - // August 28, 2009 (Friday) + // August 28, 2009 (Friday) // } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.formatting.overview/cs/icustomformatter1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.formatting.overview/cs/icustomformatter1.cs index f65022335567d..6e7acc241d6de 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.formatting.overview/cs/icustomformatter1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.formatting.overview/cs/icustomformatter1.cs @@ -4,32 +4,32 @@ public class ByteByByteFormatter : IFormatProvider, ICustomFormatter { public object GetFormat(Type formatType) - { + { if (formatType == typeof(ICustomFormatter)) return this; else return null; } - - public string Format(string format, object arg, + + public string Format(string format, object arg, IFormatProvider formatProvider) - { + { if (! formatProvider.Equals(this)) return null; - + // Handle only hexadecimal format string. if (! format.StartsWith("X")) return null; - + byte[] bytes; string output = null; - + // Handle only integral types. - if (arg is Byte) + if (arg is Byte) bytes = BitConverter.GetBytes((Byte) arg); else if (arg is Int16) bytes = BitConverter.GetBytes((Int16) arg); else if (arg is Int32) bytes = BitConverter.GetBytes((Int32) arg); - else if (arg is Int64) + else if (arg is Int64) bytes = BitConverter.GetBytes((Int64) arg); else if (arg is SByte) bytes = BitConverter.GetBytes((SByte) arg); @@ -43,8 +43,8 @@ public string Format(string format, object arg, return null; for (int ctr = bytes.Length - 1; ctr >= 0; ctr--) - output += String.Format("{0:X2} ", bytes[ctr]); - + output += String.Format("{0:X2} ", bytes[ctr]); + return output.Trim(); } } @@ -55,13 +55,13 @@ public class Example { public static void Main() { - long value = 3210662321; + long value = 3210662321; byte value1 = 214; byte value2 = 19; - + Console.WriteLine(String.Format(new ByteByByteFormatter(), "{0:X}", value)); - Console.WriteLine(String.Format(new ByteByByteFormatter(), "{0:X} And {1:X} = {2:X} ({2:000})", - value1, value2, value1 & value2)); + Console.WriteLine(String.Format(new ByteByByteFormatter(), "{0:X} And {1:X} = {2:X} ({2:000})", + value1, value2, value1 & value2)); Console.WriteLine(String.Format(new ByteByByteFormatter(), "{0,10:N0}", value)); } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.formatting.overview/cs/iformattable.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.formatting.overview/cs/iformattable.cs index c0911684f5778..c3bb65f0b611b 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.formatting.overview/cs/iformattable.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.formatting.overview/cs/iformattable.cs @@ -10,17 +10,17 @@ public Temperature(decimal temperature) { this.m_Temp = temperature; } - + public decimal Celsius { get { return this.m_Temp; } } - + public decimal Kelvin { - get { return this.m_Temp + 273.15m; } + get { return this.m_Temp + 273.15m; } } - + public decimal Fahrenheit { get { return Math.Round((decimal) this.m_Temp * 9 / 5 + 32, 2); } @@ -30,13 +30,13 @@ public override string ToString() { return this.ToString("G", null); } - + public string ToString(string format) { return this.ToString(format, null); } - - public string ToString(string format, IFormatProvider provider) + + public string ToString(string format, IFormatProvider provider) { // Handle null or empty arguments. if (String.IsNullOrEmpty(format)) @@ -46,7 +46,7 @@ public string ToString(string format, IFormatProvider provider) if (provider == null) provider = NumberFormatInfo.CurrentInfo; - + switch (format) { // Convert temperature to Fahrenheit and return string. @@ -61,7 +61,7 @@ public string ToString(string format, IFormatProvider provider) return this.Celsius.ToString("N2", provider) + "°C"; default: throw new FormatException(String.Format("The '{0}' format string is not supported.", format)); - } + } } } // diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.formatting.overview/cs/overrides1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.formatting.overview/cs/overrides1.cs index 0ba0df6ecf366..0e51e38472417 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.formatting.overview/cs/overrides1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.formatting.overview/cs/overrides1.cs @@ -4,10 +4,10 @@ public class Temperature { private decimal temp; - + public Temperature(decimal temperature) { - this.temp = temperature; + this.temp = temperature; } public override string ToString() diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.formatting.overview/cs/specifier1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.formatting.overview/cs/specifier1.cs index cfb2515114b21..1155638f53ed5 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.formatting.overview/cs/specifier1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.formatting.overview/cs/specifier1.cs @@ -10,9 +10,9 @@ public static void Main() // // - double cost = 1632.54; - Console.WriteLine(cost.ToString("C", - new System.Globalization.CultureInfo("en-US"))); + double cost = 1632.54; + Console.WriteLine(cost.ToString("C", + new System.Globalization.CultureInfo("en-US"))); // The example displays the following output: // $1,632.54 // diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.formatting.overview/cs/standard1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.formatting.overview/cs/standard1.cs index 138486556a56c..cf3d10f87cee0 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.formatting.overview/cs/standard1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.formatting.overview/cs/standard1.cs @@ -7,7 +7,7 @@ public static void Main() // DayOfWeek thisDay = DayOfWeek.Monday; string[] formatStrings = {"G", "F", "D", "X"}; - + foreach (string formatString in formatStrings) Console.WriteLine(thisDay.ToString(formatString)); // The example displays the following output: diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.generics.overview/cs/source2.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.generics.overview/cs/source2.cs index ede79a8bdc9ae..493910419e392 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.generics.overview/cs/source2.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.generics.overview/cs/source2.cs @@ -4,12 +4,12 @@ public class MyEventArgs : EventArgs { private string msg; - + public MyEventArgs(string messageArg) { msg = messageArg; } - + public string Message { get {return msg;} diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/codepages1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/codepages1.cs index c477c23cf4893..f26f54a9ea632 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/codepages1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/codepages1.cs @@ -8,30 +8,30 @@ public class Example public static void Main() { // Represent Greek uppercase characters in code page 737. - char[] greekChars = { 'Α', 'Β', 'Γ', 'Δ', 'Ε', 'Ζ', 'Η', 'Θ', - 'Ι', 'Κ', 'Λ', 'Μ', 'Ν', 'Ξ', 'Ο', 'Π', + char[] greekChars = { 'Α', 'Β', 'Γ', 'Δ', 'Ε', 'Ζ', 'Η', 'Θ', + 'Ι', 'Κ', 'Λ', 'Μ', 'Ν', 'Ξ', 'Ο', 'Π', 'Ρ', 'Σ', 'Τ', 'Υ', 'Φ', 'Χ', 'Ψ', 'Ω' }; - + Encoding cp737 = Encoding.GetEncoding(737); int nBytes = cp737.GetByteCount(greekChars); byte[] bytes737 = new byte[nBytes]; bytes737 = cp737.GetBytes(greekChars); // Write the bytes to a file. FileStream fs = new FileStream(@".\\CodePageBytes.dat", FileMode.Create); - fs.Write(bytes737, 0, bytes737.Length); + fs.Write(bytes737, 0, bytes737.Length); fs.Close(); - + // Retrieve the byte data from the file. fs = new FileStream(@".\\CodePageBytes.dat", FileMode.Open); byte[] bytes1 = new byte[fs.Length]; fs.Read(bytes1, 0, (int)fs.Length); fs.Close(); - + // Restore the data on a system whose code page is 737. string data = cp737.GetString(bytes1); - Console.WriteLine(data); + Console.WriteLine(data); Console.WriteLine(); - + // Restore the data on a system whose code page is 1252. Encoding cp1252 = Encoding.GetEncoding(1252); data = cp1252.GetString(bytes1); diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/currency1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/currency1.cs index 2a1881784f692..ccb12f9f5b8ee 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/currency1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/currency1.cs @@ -12,18 +12,18 @@ public static void Main() Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-US"); Decimal value = 16039.47m; Console.WriteLine("Current Culture: {0}", CultureInfo.CurrentCulture.DisplayName); - Console.WriteLine("Currency Value: {0:C2}", value); - + Console.WriteLine("Currency Value: {0:C2}", value); + // Persist the currency value as a string. StreamWriter sw = new StreamWriter("currency.dat"); sw.Write(value.ToString("C2")); sw.Close(); - + // Read the persisted data using the current culture. StreamReader sr = new StreamReader("currency.dat"); string currencyData = sr.ReadToEnd(); sr.Close(); - + // Restore and display the data using the conventions of the current culture. Decimal restoredValue; if (Decimal.TryParse(currencyData, out restoredValue)) @@ -31,11 +31,11 @@ public static void Main() else Console.WriteLine("ERROR: Unable to parse '{0}'", currencyData); Console.WriteLine(); - + // Restore and display the data using the conventions of the en-GB culture. Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-GB"); - Console.WriteLine("Current Culture: {0}", - Thread.CurrentThread.CurrentCulture.DisplayName); + Console.WriteLine("Current Culture: {0}", + Thread.CurrentThread.CurrentCulture.DisplayName); if (Decimal.TryParse(currencyData, NumberStyles.Currency, null, out restoredValue)) Console.WriteLine(restoredValue.ToString("C2")); else @@ -47,7 +47,7 @@ public static void Main() // Current Culture: English (United States) // Currency Value: $16,039.47 // ERROR: Unable to parse '$16,039.47' -// +// // Current Culture: English (United Kingdom) // ERROR: Unable to parse '$16,039.47' // diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/currency2.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/currency2.cs index c9e75f582beea..1817d555033f2 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/currency2.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/currency2.cs @@ -13,8 +13,8 @@ public static void Main() Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-US"); Decimal value = 16039.47m; Console.WriteLine("Current Culture: {0}", CultureInfo.CurrentCulture.DisplayName); - Console.WriteLine("Currency Value: {0:C2}", value); - + Console.WriteLine("Currency Value: {0:C2}", value); + // Serialize the currency data. BinaryFormatter bf = new BinaryFormatter(); FileStream fw = new FileStream("currency.dat", FileMode.Create); @@ -22,16 +22,16 @@ public static void Main() bf.Serialize(fw, data); fw.Close(); Console.WriteLine(); - + // Change the current thread culture. Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-GB"); Console.WriteLine("Current Culture: {0}", CultureInfo.CurrentCulture.DisplayName); - + // Deserialize the data. FileStream fr = new FileStream("currency.dat", FileMode.Open); CurrencyValue restoredData = (CurrencyValue) bf.Deserialize(fr); fr.Close(); - + // Display the original value. CultureInfo culture = CultureInfo.CreateSpecificCulture(restoredData.CultureName); Console.WriteLine("Currency Value: {0}", restoredData.Amount.ToString("C2", culture)); @@ -42,17 +42,17 @@ [Serializable] internal struct CurrencyValue { public CurrencyValue(Decimal amount, string name) { - this.Amount = amount; + this.Amount = amount; this.CultureName = name; } - + public Decimal Amount; - public string CultureName; + public string CultureName; } // The example displays the following output: // Current Culture: English (United States) // Currency Value: $16,039.47 -// +// // Current Culture: English (United Kingdom) // Currency Value: $16,039.47 // diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/dates1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/dates1.cs index 6547265d77da7..0777681ccd47a 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/dates1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/dates1.cs @@ -14,7 +14,7 @@ public static void Main() ShowDayInfo(); Console.WriteLine(); Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-GB"); - ShowDayInfo(); + ShowDayInfo(); } private static void ShowDayInfo() @@ -28,7 +28,7 @@ private static void ShowDayInfo() // Date: 11. listopada 2012. // Sunrise: 7:06:00 // Sunset: 18:19:00 -// +// // Date: 11 October 2012 // Sunrise: 07:06:00 // Sunset: 18:19:00 diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/dates2.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/dates2.cs index 0960fc3612155..4ac2fb7c07b0e 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/dates2.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/dates2.cs @@ -10,21 +10,21 @@ public static void Main() { // Persist two dates as strings. Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-US"); - DateTime[] dates = { new DateTime(2013, 1, 9), + DateTime[] dates = { new DateTime(2013, 1, 9), new DateTime(2013, 8, 18) }; StreamWriter sw = new StreamWriter("dateData.dat"); sw.Write("{0:d}|{1:d}", dates[0], dates[1]); sw.Close(); - + // Read the persisted data. StreamReader sr = new StreamReader("dateData.dat"); string dateData = sr.ReadToEnd(); sr.Close(); string[] dateStrings = dateData.Split('|'); - + // Restore and display the data using the conventions of the en-US culture. - Console.WriteLine("Current Culture: {0}", - Thread.CurrentThread.CurrentCulture.DisplayName); + Console.WriteLine("Current Culture: {0}", + Thread.CurrentThread.CurrentCulture.DisplayName); foreach (var dateStr in dateStrings) { DateTime restoredDate; if (DateTime.TryParse(dateStr, out restoredDate)) @@ -33,25 +33,25 @@ public static void Main() Console.WriteLine("ERROR: Unable to parse {0}", dateStr); } Console.WriteLine(); - + // Restore and display the data using the conventions of the en-GB culture. Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-GB"); - Console.WriteLine("Current Culture: {0}", - Thread.CurrentThread.CurrentCulture.DisplayName); + Console.WriteLine("Current Culture: {0}", + Thread.CurrentThread.CurrentCulture.DisplayName); foreach (var dateStr in dateStrings) { DateTime restoredDate; if (DateTime.TryParse(dateStr, out restoredDate)) Console.WriteLine("The date is {0:D}", restoredDate); else Console.WriteLine("ERROR: Unable to parse {0}", dateStr); - } + } } } // The example displays the following output: // Current Culture: English (United States) // The date is Wednesday, January 09, 2013 // The date is Sunday, August 18, 2013 -// +// // Current Culture: English (United Kingdom) // The date is 01 September 2013 // ERROR: Unable to parse 8/18/2013 diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/dates3.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/dates3.cs index 9048e303cb878..26f3aa36dff93 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/dates3.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/dates3.cs @@ -10,22 +10,22 @@ public static void Main() { // Persist two dates as strings. Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-US"); - DateTime[] dates = { new DateTime(2013, 1, 9), + DateTime[] dates = { new DateTime(2013, 1, 9), new DateTime(2013, 8, 18) }; StreamWriter sw = new StreamWriter("dateData.dat"); - sw.Write(String.Format(CultureInfo.InvariantCulture, + sw.Write(String.Format(CultureInfo.InvariantCulture, "{0:d}|{1:d}", dates[0], dates[1])); sw.Close(); - + // Read the persisted data. StreamReader sr = new StreamReader("dateData.dat"); string dateData = sr.ReadToEnd(); sr.Close(); string[] dateStrings = dateData.Split('|'); - + // Restore and display the data using the conventions of the en-US culture. - Console.WriteLine("Current Culture: {0}", - Thread.CurrentThread.CurrentCulture.DisplayName); + Console.WriteLine("Current Culture: {0}", + Thread.CurrentThread.CurrentCulture.DisplayName); foreach (var dateStr in dateStrings) { DateTime restoredDate; if (DateTime.TryParse(dateStr, CultureInfo.InvariantCulture, @@ -35,11 +35,11 @@ public static void Main() Console.WriteLine("ERROR: Unable to parse {0}", dateStr); } Console.WriteLine(); - + // Restore and display the data using the conventions of the en-GB culture. Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-GB"); - Console.WriteLine("Current Culture: {0}", - Thread.CurrentThread.CurrentCulture.DisplayName); + Console.WriteLine("Current Culture: {0}", + Thread.CurrentThread.CurrentCulture.DisplayName); foreach (var dateStr in dateStrings) { DateTime restoredDate; if (DateTime.TryParse(dateStr, CultureInfo.InvariantCulture, @@ -47,14 +47,14 @@ public static void Main() Console.WriteLine("The date is {0:D}", restoredDate); else Console.WriteLine("ERROR: Unable to parse {0}", dateStr); - } + } } } // The example displays the following output: // Current Culture: English (United States) // The date is Wednesday, January 09, 2013 // The date is Sunday, August 18, 2013 -// +// // Current Culture: English (United Kingdom) // The date is 09 January 2013 // The date is 18 August 2013 diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/dates4.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/dates4.cs index 85739e14f0cf9..743bddb9a0a79 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/dates4.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/dates4.cs @@ -8,17 +8,17 @@ public class Example public static void Main() { BinaryFormatter formatter = new BinaryFormatter(); - + DateTime dateOriginal = new DateTime(2013, 3, 30, 18, 0, 0); dateOriginal = DateTime.SpecifyKind(dateOriginal, DateTimeKind.Local); // Serialize a date. if (! File.Exists("DateInfo.dat")) { StreamWriter sw = new StreamWriter("DateInfo.dat"); - sw.Write("{0:G}|{0:s}|{0:o}", dateOriginal); + sw.Write("{0:G}|{0:s}|{0:o}", dateOriginal); sw.Close(); Console.WriteLine("Serialized dates to DateInfo.dat"); - } + } // Serialize the data as a binary value. if (! File.Exists("DateInfo.bin")) { FileStream fsIn = new FileStream("DateInfo.bin", FileMode.Create); @@ -27,7 +27,7 @@ public static void Main() Console.WriteLine("Serialized date to DateInfo.bin"); } Console.WriteLine(); - + // Restore the date from string values. StreamReader sr = new StreamReader("DateInfo.dat"); string datesToSplit = sr.ReadToEnd(); @@ -38,7 +38,7 @@ public static void Main() dateStr, newDate, newDate.Kind); } Console.WriteLine(); - + // Restore the date from binary data. FileStream fsOut = new FileStream("DateInfo.bin", FileMode.Open); DateTime restoredDate = (DateTime) formatter.Deserialize(fsOut); diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/dates5.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/dates5.cs index 7adaee08a62b3..8d6b77e81353f 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/dates5.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/dates5.cs @@ -5,11 +5,11 @@ public class Example { public static void Main() { - DateTime date1 = DateTime.SpecifyKind(new DateTime(2013, 3, 9, 10, 30, 0), + DateTime date1 = DateTime.SpecifyKind(new DateTime(2013, 3, 9, 10, 30, 0), DateTimeKind.Local); TimeSpan interval = new TimeSpan(48, 0, 0); DateTime date2 = date1 + interval; - Console.WriteLine("{0:g} + {1:N1} hours = {2:g}", + Console.WriteLine("{0:g} + {1:N1} hours = {2:g}", date1, interval.TotalHours, date2); } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/dates6.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/dates6.cs index 5d4c6ab76085c..952e11bc13851 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/dates6.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/dates6.cs @@ -6,13 +6,13 @@ public class Example public static void Main() { TimeZoneInfo pst = TimeZoneInfo.FindSystemTimeZoneById("Pacific Standard Time"); - DateTime date1 = DateTime.SpecifyKind(new DateTime(2013, 3, 9, 10, 30, 0), + DateTime date1 = DateTime.SpecifyKind(new DateTime(2013, 3, 9, 10, 30, 0), DateTimeKind.Local); DateTime utc1 = date1.ToUniversalTime(); TimeSpan interval = new TimeSpan(48, 0, 0); DateTime utc2 = utc1 + interval; DateTime date2 = TimeZoneInfo.ConvertTimeFromUtc(utc2, pst); - Console.WriteLine("{0:g} + {1:N1} hours = {2:g}", + Console.WriteLine("{0:g} + {1:N1} hours = {2:g}", date1, interval.TotalHours, date2); } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/dates8.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/dates8.cs index a2adb2a68823d..4304eaec62029 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/dates8.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/dates8.cs @@ -8,7 +8,7 @@ public class Example public static void Main() { BinaryFormatter formatter = new BinaryFormatter(); - + // Serialize a date. DateTime dateOriginal = new DateTime(2013, 3, 30, 18, 0, 0); dateOriginal = DateTime.SpecifyKind(dateOriginal, DateTimeKind.Local); @@ -16,11 +16,11 @@ public static void Main() // Serialize the date in string form. if (! File.Exists("DateInfo2.dat")) { StreamWriter sw = new StreamWriter("DateInfo2.dat"); - sw.Write("{0:o}|{1:r}|{1:u}", dateOriginal, - dateOriginal.ToUniversalTime()); + sw.Write("{0:o}|{1:r}|{1:u}", dateOriginal, + dateOriginal.ToUniversalTime()); sw.Close(); Console.WriteLine("Serialized dates to DateInfo.dat"); - } + } // Serialize the date as a binary value. if (! File.Exists("DateInfo2.bin")) { FileStream fsIn = new FileStream("DateInfo2.bin", FileMode.Create); @@ -29,7 +29,7 @@ public static void Main() Console.WriteLine("Serialized date to DateInfo.bin"); } Console.WriteLine(); - + // Restore the date from string values. StreamReader sr = new StreamReader("DateInfo2.dat"); string datesToSplit = sr.ReadToEnd(); @@ -37,17 +37,17 @@ public static void Main() for (int ctr = 0; ctr < dateStrings.Length; ctr++) { DateTime newDate = DateTime.Parse(dateStrings[ctr]); if (ctr == 1) { - Console.WriteLine("'{0}' --> {1} {2}", + Console.WriteLine("'{0}' --> {1} {2}", dateStrings[ctr], newDate, newDate.Kind); } else { DateTime newLocalDate = newDate.ToLocalTime(); - Console.WriteLine("'{0}' --> {1} {2}", + Console.WriteLine("'{0}' --> {1} {2}", dateStrings[ctr], newLocalDate, newLocalDate.Kind); } } Console.WriteLine(); - + // Restore the date from binary data. FileStream fsOut = new FileStream("DateInfo2.bin", FileMode.Open); DateTime restoredDate = (DateTime) formatter.Deserialize(fsOut); diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/equals1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/equals1.cs index 93522e320b64d..e760aa2a42013 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/equals1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/equals1.cs @@ -16,7 +16,7 @@ public static void Main() // Prohibit access. Console.WriteLine("Access is not allowed."); } - + private static bool AccessesFileSystem(string uri) { return uri.StartsWith("FILE", true, CultureInfo.CurrentCulture); diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/equals2.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/equals2.cs index d1a217a42019d..d60982684d31b 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/equals2.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/equals2.cs @@ -16,7 +16,7 @@ public static void Main() // Prohibit access. Console.WriteLine("Access is not allowed."); } - + private static bool AccessesFileSystem(string uri) { return uri.StartsWith("FILE", StringComparison.OrdinalIgnoreCase); diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/monthname1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/monthname1.cs index 15c9cec6bc143..a455d4dbee625 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/monthname1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/monthname1.cs @@ -6,9 +6,9 @@ public class Example public static void Main() { DateTime midYear = new DateTime(2013, 7, 1); - Console.WriteLine("{0:d} is a {1}.", midYear, GetDayName(midYear)); + Console.WriteLine("{0:d} is a {1}.", midYear, GetDayName(midYear)); } - + private static string GetDayName(DateTime date) { return date.DayOfWeek.ToString("G"); diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/monthname2.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/monthname2.cs index c1af67987aecd..38f64ae379cb1 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/monthname2.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/monthname2.cs @@ -8,42 +8,42 @@ public class Example public static void Main() { // Set the current thread culture to French (France). - Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("fr-FR"); - + Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("fr-FR"); + DateTime midYear = new DateTime(2013, 7, 1); - Console.WriteLine("{0:d} is a {1}.", midYear, DateUtilities.GetDayName(midYear)); + Console.WriteLine("{0:d} is a {1}.", midYear, DateUtilities.GetDayName(midYear)); Console.WriteLine("{0:d} is a {1}.", midYear, DateUtilities.GetDayName((int) midYear.DayOfWeek)); - Console.WriteLine("{0:d} is in {1}.", midYear, DateUtilities.GetMonthName(midYear)); + Console.WriteLine("{0:d} is in {1}.", midYear, DateUtilities.GetMonthName(midYear)); Console.WriteLine("{0:d} is in {1}.", midYear, DateUtilities.GetMonthName(midYear.Month)); } -} +} public static class DateUtilities { - public static string GetDayName(int dayOfWeek) + public static string GetDayName(int dayOfWeek) { if (dayOfWeek < 0 | dayOfWeek > DateTimeFormatInfo.CurrentInfo.DayNames.Length) return String.Empty; else return DateTimeFormatInfo.CurrentInfo.DayNames[dayOfWeek]; } - + public static string GetDayName(DateTime date) - { + { return date.ToString("dddd"); } - + public static string GetMonthName(int month) - { + { if (month < 1 | month > DateTimeFormatInfo.CurrentInfo.MonthNames.Length - 1) return String.Empty; else return DateTimeFormatInfo.CurrentInfo.MonthNames[month - 1]; } - + public static string GetMonthName(DateTime date) - { - return date.ToString("MMMM"); + { + return date.ToString("MMMM"); } } // The example displays the following output: diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/numbers1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/numbers1.cs index cdb1bc32fce3b..c62bb28ea2c09 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/numbers1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/numbers1.cs @@ -8,32 +8,32 @@ public class Example public static void Main() { DateTime dateForMonth = new DateTime(2013, 1, 1); - double[] temperatures = { 3.4, 3.5, 7.6, 10.4, 14.5, 17.2, + double[] temperatures = { 3.4, 3.5, 7.6, 10.4, 14.5, 17.2, 19.9, 18.2, 15.9, 11.3, 6.9, 5.3 }; Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("fr-FR"); Console.WriteLine("Current Culture: {0}", CultureInfo.CurrentCulture.DisplayName); // Build the format string dynamically so we allocate enough space for the month name. - string fmtString = "{0,-" + GetLongestMonthNameLength().ToString() + ":MMMM} {1,4}"; + string fmtString = "{0,-" + GetLongestMonthNameLength().ToString() + ":MMMM} {1,4}"; for (int ctr = 0; ctr < temperatures.Length; ctr++) - Console.WriteLine(fmtString, - dateForMonth.AddMonths(ctr), + Console.WriteLine(fmtString, + dateForMonth.AddMonths(ctr), temperatures[ctr]); Console.WriteLine(); - + Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-US"); Console.WriteLine("Current Culture: {0}", CultureInfo.CurrentCulture.DisplayName); - fmtString = "{0,-" + GetLongestMonthNameLength().ToString() + ":MMMM} {1,4}"; + fmtString = "{0,-" + GetLongestMonthNameLength().ToString() + ":MMMM} {1,4}"; for (int ctr = 0; ctr < temperatures.Length; ctr++) - Console.WriteLine(fmtString, - dateForMonth.AddMonths(ctr), + Console.WriteLine(fmtString, + dateForMonth.AddMonths(ctr), temperatures[ctr]); } private static int GetLongestMonthNameLength() { - int length = 0; + int length = 0; foreach (var nameOfMonth in DateTimeFormatInfo.CurrentInfo.MonthNames) if (nameOfMonth.Length > length) length = nameOfMonth.Length; @@ -54,7 +54,7 @@ private static int GetLongestMonthNameLength() // octobre 11,3 // novembre 6,9 // décembre 5,3 -// +// // Current Culture: English (United States) // January 3.4 // February 3.5 diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/numbers2.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/numbers2.cs index 3cca7fe1f292e..deef7f6fef5cf 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/numbers2.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/numbers2.cs @@ -12,23 +12,23 @@ public static void Main() Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-US"); double[] numbers = GetRandomNumbers(10); DisplayRandomNumbers(numbers); - + // Persist the numbers as strings. StreamWriter sw = new StreamWriter("randoms.dat"); for (int ctr = 0; ctr < numbers.Length; ctr++) sw.Write("{0:R}{1}", numbers[ctr], ctr < numbers.Length - 1 ? "|" : ""); sw.Close(); - + // Read the persisted data. StreamReader sr = new StreamReader("randoms.dat"); string numericData = sr.ReadToEnd(); sr.Close(); string[] numberStrings = numericData.Split('|'); - + // Restore and display the data using the conventions of the en-US culture. - Console.WriteLine("Current Culture: {0}", - Thread.CurrentThread.CurrentCulture.DisplayName); + Console.WriteLine("Current Culture: {0}", + Thread.CurrentThread.CurrentCulture.DisplayName); foreach (var numberStr in numberStrings) { double restoredNumber; if (Double.TryParse(numberStr, out restoredNumber)) @@ -37,11 +37,11 @@ public static void Main() Console.WriteLine("ERROR: Unable to parse '{0}'", numberStr); } Console.WriteLine(); - + // Restore and display the data using the conventions of the fr-FR culture. Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("fr-FR"); - Console.WriteLine("Current Culture: {0}", - Thread.CurrentThread.CurrentCulture.DisplayName); + Console.WriteLine("Current Culture: {0}", + Thread.CurrentThread.CurrentCulture.DisplayName); foreach (var numberStr in numberStrings) { double restoredNumber; if (Double.TryParse(numberStr, out restoredNumber)) @@ -59,7 +59,7 @@ private static double[] GetRandomNumbers(int n) numbers[ctr] = rnd.NextDouble() * 1000; return numbers; } - + private static void DisplayRandomNumbers(double[] numbers) { for (int ctr = 0; ctr < numbers.Length; ctr++) @@ -78,7 +78,7 @@ private static void DisplayRandomNumbers(double[] numbers) // 562.25210175023039 // 600.7711019370571 // 299.46113717717174 -// +// // Current Culture: English (United States) // 487.0313743534644 // 674.12000879371533 @@ -90,7 +90,7 @@ private static void DisplayRandomNumbers(double[] numbers) // 562.25210175023039 // 600.7711019370571 // 299.46113717717174 -// +// // Current Culture: French (France) // ERROR: Unable to parse '487.0313743534644' // ERROR: Unable to parse '674.12000879371533' diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/numbers3.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/numbers3.cs index ff27edfde196d..9103d9c1aa101 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/numbers3.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/numbers3.cs @@ -13,27 +13,27 @@ public static void Main() Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-US"); double[] numbers = GetRandomNumbers(10); DisplayRandomNumbers(numbers); - + // Serialize the array. FileStream fsIn = new FileStream("randoms.dat", FileMode.Create); BinaryFormatter formatter = new BinaryFormatter(); formatter.Serialize(fsIn, numbers); fsIn.Close(); - + // Read the persisted data. FileStream fsOut = new FileStream("randoms.dat", FileMode.Open); - double[] numbers1 = (Double[]) formatter.Deserialize(fsOut); + double[] numbers1 = (Double[]) formatter.Deserialize(fsOut); fsOut.Close(); - + // Display the data using the conventions of the en-US culture. - Console.WriteLine("Current Culture: {0}", - Thread.CurrentThread.CurrentCulture.DisplayName); + Console.WriteLine("Current Culture: {0}", + Thread.CurrentThread.CurrentCulture.DisplayName); DisplayRandomNumbers(numbers1); - + // Display the data using the conventions of the fr-FR culture. Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("fr-FR"); - Console.WriteLine("Current Culture: {0}", - Thread.CurrentThread.CurrentCulture.DisplayName); + Console.WriteLine("Current Culture: {0}", + Thread.CurrentThread.CurrentCulture.DisplayName); DisplayRandomNumbers(numbers1); } @@ -45,7 +45,7 @@ private static double[] GetRandomNumbers(int n) numbers[ctr] = rnd.NextDouble() * 1000; return numbers; } - + private static void DisplayRandomNumbers(double[] numbers) { for (int ctr = 0; ctr < numbers.Length; ctr++) @@ -64,7 +64,7 @@ private static void DisplayRandomNumbers(double[] numbers) // 83.79498919648816 // 957.31006048494487 // 996.54487892824454 -// +// // Current Culture: English (United States) // 932.10070623648392 // 96.868112262742642 @@ -76,7 +76,7 @@ private static void DisplayRandomNumbers(double[] numbers) // 83.79498919648816 // 957.31006048494487 // 996.54487892824454 -// +// // Current Culture: French (France) // 932,10070623648392 // 96,868112262742642 diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/search1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/search1.cs index fe422ad02f93a..e31fe7f7158e1 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/search1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/search1.cs @@ -8,7 +8,7 @@ public class Example public static void Main() { Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("pl-PL"); - string composite = "\u0041\u0300"; + string composite = "\u0041\u0300"; Console.WriteLine("Comparing using Char: {0}", composite.IndexOf('\u00C0')); Console.WriteLine("Comparing using String: {0}", composite.IndexOf("\u00C0")); } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/sort1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/sort1.cs index 596f02cb7afb6..1e47d3239c562 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/sort1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/sort1.cs @@ -7,7 +7,7 @@ public class Example { public static void Main() { - string[] values = { "able", "ångström", "apple", "Æble", + string[] values = { "able", "ångström", "apple", "Æble", "Windows", "Visual Studio" }; // Change thread to en-US. Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-US"); @@ -23,12 +23,12 @@ public static void Main() // Compare the sorted arrays. Console.WriteLine("{0,-8} {1,-15} {2,-15}\n", "Position", "en-US", "sv-SE"); for (int ctr = 0; ctr <= values.GetUpperBound(0); ctr++) - Console.WriteLine("{0,-8} {1,-15} {2,-15}", ctr, enValues[ctr], svValues[ctr]); + Console.WriteLine("{0,-8} {1,-15} {2,-15}", ctr, enValues[ctr], svValues[ctr]); } } // The example displays the following output: // Position en-US sv-SE -// +// // 0 able able // 1 Æble Æble // 2 ångström apple diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/sortkey1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/sortkey1.cs index e3627a8096634..6ed75d05cd106 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/sortkey1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.globalization/cs/sortkey1.cs @@ -9,9 +9,9 @@ public class SortKeyComparer : IComparer public int Compare(string str1, string str2) { SortKey sk1, sk2; - sk1 = CultureInfo.CurrentCulture.CompareInfo.GetSortKey(str1); - sk2 = CultureInfo.CurrentCulture.CompareInfo.GetSortKey(str2); - return SortKey.Compare(sk1, sk2); + sk1 = CultureInfo.CurrentCulture.CompareInfo.GetSortKey(str1); + sk2 = CultureInfo.CurrentCulture.CompareInfo.GetSortKey(str2); + return SortKey.Compare(sk1, sk2); } } @@ -19,10 +19,10 @@ public class Example { public static void Main() { - string[] values = { "able", "ångström", "apple", "Æble", + string[] values = { "able", "ångström", "apple", "Æble", "Windows", "Visual Studio" }; SortKeyComparer comparer = new SortKeyComparer(); - + // Change thread to en-US. Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-US"); // Sort the array and copy it to a new array to preserve the order. @@ -37,12 +37,12 @@ public static void Main() // Compare the sorted arrays. Console.WriteLine("{0,-8} {1,-15} {2,-15}\n", "Position", "en-US", "sv-SE"); for (int ctr = 0; ctr <= values.GetUpperBound(0); ctr++) - Console.WriteLine("{0,-8} {1,-15} {2,-15}", ctr, enValues[ctr], svValues[ctr]); + Console.WriteLine("{0,-8} {1,-15} {2,-15}", ctr, enValues[ctr], svValues[ctr]); } } // The example displays the following output: // Position en-US sv-SE -// +// // 0 able able // 1 Æble Æble // 2 ångström apple diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.interop.marshaling/cs/arrays.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.interop.marshaling/cs/arrays.cs index 54bfe6bbbbc8f..cb0895721846f 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.interop.marshaling/cs/arrays.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.interop.marshaling/cs/arrays.cs @@ -38,7 +38,7 @@ internal static extern int TestArrayOfInts( [In, Out] int[] array, int size); // Declares a managed prototype for an array of integers by reference. - // The array size can change, but the array is not copied back + // The array size can change, but the array is not copied back // automatically because the marshaler does not know the resulting size. // The copy must be performed manually. [DllImport("..\\LIB\\PinvokeLib.dll", CallingConvention = CallingConvention.Cdecl)] @@ -72,7 +72,7 @@ public class App { public static void Main() { - // array ByVal + // array ByVal int[] array1 = new int[10]; Console.WriteLine("Integer array passed ByVal before call:"); for (int i = 0; i < array1.Length; i++) @@ -90,7 +90,7 @@ public static void Main() Console.Write(" " + i); } - // array ByRef + // array ByRef int[] array2 = new int[10]; int size = array2.Length; Console.WriteLine("\n\nInteger array passed ByRef before call:"); @@ -122,7 +122,7 @@ public static void Main() Console.WriteLine("\nArray after call is empty"); } - // matrix ByVal + // matrix ByVal const int DIM = 5; int[,] matrix = new int[DIM, DIM]; @@ -151,7 +151,7 @@ public static void Main() Console.WriteLine(""); } - // string array ByVal + // string array ByVal string[] strArray = { "one", "two", "three", "four", "five" }; Console.WriteLine("\n\nstring array before call:"); foreach (string s in strArray) @@ -167,7 +167,7 @@ public static void Main() Console.Write(" " + s); } - // struct array ByVal + // struct array ByVal MyPoint[] points = { new MyPoint(1, 1), new MyPoint(2, 2), new MyPoint(3, 3) }; Console.WriteLine("\n\nPoints array before call:"); foreach (MyPoint p in points) @@ -183,7 +183,7 @@ public static void Main() Console.WriteLine($"X = {p.X}, Y = {p.Y}"); } - // struct with strings array ByVal + // struct with strings array ByVal MyPerson[] persons = { new MyPerson("Kim", "Akers"), diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.isolatedstorage/cs/source2.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.isolatedstorage/cs/source2.cs index f307ae8768c80..0f4901319e005 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.isolatedstorage/cs/source2.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.isolatedstorage/cs/source2.cs @@ -15,7 +15,7 @@ public static void Main() isoStore.CreateFile("TestFileC.Txt"); isoStore.CreateFile("TestFileD.Txt"); } - + IEnumerator allFiles = IsolatedStorageFile.GetEnumerator(IsolatedStorageScope.User); long totalsize = 0; @@ -24,7 +24,7 @@ public static void Main() IsolatedStorageFile storeFile = (IsolatedStorageFile)allFiles.Current; totalsize += (long)storeFile.UsedSize; } - + Console.WriteLine("The total size = " + totalsize); } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.isolatedstorage/cs/source5.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.isolatedstorage/cs/source5.cs index 1a965a86abdc2..b3f277f7390b9 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.isolatedstorage/cs/source5.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.isolatedstorage/cs/source5.cs @@ -33,7 +33,7 @@ static void Main(string[] args) Console.WriteLine("You have written to the file."); } } - } + } } } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.localizability/cs/ismetric1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.localizability/cs/ismetric1.cs index bdcf2f987d7ea..bc183b7666de3 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.localizability/cs/ismetric1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.localizability/cs/ismetric1.cs @@ -6,13 +6,13 @@ public class Example { public static void Main() { - string[] cultureNames = { "en-US", "en-GB", "fr-FR", + string[] cultureNames = { "en-US", "en-GB", "fr-FR", "ne-NP", "es-BO", "ig-NG" }; foreach (var cultureName in cultureNames) { RegionInfo region = new RegionInfo(cultureName); Console.WriteLine("{0} {1} the metric system.", region.EnglishName, region.IsMetric ? "uses" : "does not use"); - } + } } } // The example displays the following output: diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.observerdesign.howto/cs/observer.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.observerdesign.howto/cs/observer.cs index 193f8d9e9f6f4..fe13f4f1d49b4 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.observerdesign.howto/cs/observer.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.observerdesign.howto/cs/observer.cs @@ -24,7 +24,7 @@ public virtual void Unsubscribe() // // - public virtual void OnCompleted() + public virtual void OnCompleted() { Console.WriteLine("Additional temperature data will not be transmitted."); } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.observerdesign.howto/cs/provider.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.observerdesign.howto/cs/provider.cs index 5475730d2715c..fc5443766042b 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.observerdesign.howto/cs/provider.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.observerdesign.howto/cs/provider.cs @@ -28,7 +28,7 @@ public Unsubscriber(List> observers, IObserver(); string flightNo = String.Format("{0,5}", info.FlightNumber); - + foreach (var flightInfo in flightInfos) { if (flightInfo.Substring(21, 5).Equals(flightNo)) { flightsToRemove.Add(flightInfo); diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.observerdesignpattern/cs/provider.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.observerdesignpattern/cs/provider.cs index 2f1794a6702d4..595d9900d14c2 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.observerdesignpattern/cs/provider.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.observerdesignpattern/cs/provider.cs @@ -108,7 +108,7 @@ internal Unsubscriber(List> observers, IObserver // Create or open registry key. - Microsoft.Win32.RegistryKey key; - key = Microsoft.Win32.Registry.LocalMachine.CreateSubKey( + Microsoft.Win32.RegistryKey key; + key = Microsoft.Win32.Registry.LocalMachine.CreateSubKey( @"System\CurrentControlSet\Services\.NETFramework\Performance"); // Create or overwrite value. - key.SetValue("ProcessNameFormat", 1, + key.SetValue("ProcessNameFormat", 1, Microsoft.Win32.RegistryValueKind.DWord); key.Close(); // diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.assertions/cs/endofstring1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.assertions/cs/endofstring1.cs index 351859b5c2175..6eaf2586491d3 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.assertions/cs/endofstring1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.assertions/cs/endofstring1.cs @@ -78,16 +78,16 @@ public static void Main() } // The example displays the following output: // Attempting to match the entire input string: -// +// // Attempting to match each element in a string array: // The Brooklyn Dodgers played in the National League in 1911, 1912, 1932-1957. // The Chicago Cubs played in the National League in 1903-present. // The Detroit Tigers played in the American League in 1901-present. // The New York Giants played in the National League in 1885-1957. // The Washington Senators played in the American League in 1901-1960. -// +// // Attempting to match each line of an input string with '$': -// +// // Attempting to match each line of an input string with '\r?$': // The Brooklyn Dodgers played in the National League in 1911, 1912, 1932-1957. // The Chicago Cubs played in the National League in 1903-present. diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.assertions/cs/startofstring1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.assertions/cs/startofstring1.cs index 9512659d0fa68..2075c3931a495 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.assertions/cs/startofstring1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.assertions/cs/startofstring1.cs @@ -43,7 +43,7 @@ public static void Main() } // The example displays the following output: // The Brooklyn Dodgers played in the National League in 1911, 1912, 1932-1957. -// +// // The Brooklyn Dodgers played in the National League in 1911, 1912, 1932-1957. // The Chicago Cubs played in the National League in 1903-present. // The Detroit Tigers played in the American League in 1901-present. diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.characterclasses/cs/any2.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.characterclasses/cs/any2.cs index d411693c48149..8648a94237056 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.characterclasses/cs/any2.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.characterclasses/cs/any2.cs @@ -18,6 +18,6 @@ public static void Main() } // The example displays the following output: // This\ is\ one\ line\ and\r -// +// // This\ is\ one\ line\ and\r\nthis\ is\ the\ second\. // diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.characterclasses/cs/classsubtraction1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.characterclasses/cs/classsubtraction1.cs index d6deefcfa2cd2..7e661359a5d13 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.characterclasses/cs/classsubtraction1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.characterclasses/cs/classsubtraction1.cs @@ -8,13 +8,13 @@ public static void Main() { string[] inputs = { "123", "13579753", "3557798", "335599901" }; string pattern = @"^[0-9-[2468]]+$"; - + foreach (string input in inputs) { Match match = Regex.Match(input, pattern); - if (match.Success) + if (match.Success) Console.WriteLine(match.Value); - } + } } } // The example displays the following output: diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.characterclasses/cs/digit1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.characterclasses/cs/digit1.cs index eef873a4b7ad5..4661def46b415 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.characterclasses/cs/digit1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.characterclasses/cs/digit1.cs @@ -7,13 +7,13 @@ public class Example public static void Main() { string pattern = @"^(\(?\d{3}\)?[\s-])?\d{3}-\d{4}$"; - string[] inputs = { "111 111-1111", "222-2222", "222 333-444", - "(212) 111-1111", "111-AB1-1111", + string[] inputs = { "111 111-1111", "222-2222", "222 333-444", + "(212) 111-1111", "111-AB1-1111", "212-111-1111", "01 999-9999" }; - + foreach (string input in inputs) { - if (Regex.IsMatch(input, pattern)) + if (Regex.IsMatch(input, pattern)) Console.WriteLine(input + ": matched"); else Console.WriteLine(input + ": match failed"); diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.characterclasses/cs/getunicodecategory1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.characterclasses/cs/getunicodecategory1.cs index 2f4ad8cabcc91..ffb401af2b4ba 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.characterclasses/cs/getunicodecategory1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.characterclasses/cs/getunicodecategory1.cs @@ -7,9 +7,9 @@ public class Example public static void Main() { char[] chars = { 'a', 'X', '8', ',', ' ', '\u0009', '!' }; - + foreach (char ch in chars) - Console.WriteLine("'{0}': {1}", Regex.Escape(ch.ToString()), + Console.WriteLine("'{0}': {1}", Regex.Escape(ch.ToString()), Char.GetUnicodeCategory(ch)); } } @@ -21,4 +21,4 @@ public static void Main() // '\ ': SpaceSeparator // '\t': Control // '!': OtherPunctuation -// +// diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.characterclasses/cs/nondigit1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.characterclasses/cs/nondigit1.cs index d9d5f120f5eba..ab2e1f27fba7a 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.characterclasses/cs/nondigit1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.characterclasses/cs/nondigit1.cs @@ -6,9 +6,9 @@ public class Example { public static void Main() { - string pattern = @"^\D\d{1,5}\D*$"; - string[] inputs = { "A1039C", "AA0001", "C18A", "Y938518" }; - + string pattern = @"^\D\d{1,5}\D*$"; + string[] inputs = { "A1039C", "AA0001", "C18A", "Y938518" }; + foreach (string input in inputs) { if (Regex.IsMatch(input, pattern)) diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.characterclasses/cs/nonwhitespace1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.characterclasses/cs/nonwhitespace1.cs index b832a079713b3..6818f13ebc8a2 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.characterclasses/cs/nonwhitespace1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.characterclasses/cs/nonwhitespace1.cs @@ -7,8 +7,8 @@ public class Example public static void Main() { string pattern = @"\b(\S+)\s?"; - string input = "This is the first sentence of the first paragraph. " + - "This is the second sentence.\n" + + string input = "This is the first sentence of the first paragraph. " + + "This is the second sentence.\n" + "This is the only sentence of the second paragraph."; foreach (Match match in Regex.Matches(input, pattern)) Console.WriteLine(match.Groups[1]); diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.characterclasses/cs/nonwordchar1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.characterclasses/cs/nonwordchar1.cs index 244e682a317fa..34d3384226b17 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.characterclasses/cs/nonwordchar1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.characterclasses/cs/nonwordchar1.cs @@ -14,11 +14,11 @@ public static void Main() Console.Write(" Non-word character(s):"); CaptureCollection captures = match.Groups[2].Captures; for (int ctr = 0; ctr < captures.Count; ctr++) - Console.Write(@"'{0}' (\u{1}){2}", captures[ctr].Value, - Convert.ToUInt16(captures[ctr].Value[0]).ToString("X4"), + Console.Write(@"'{0}' (\u{1}){2}", captures[ctr].Value, + Convert.ToUInt16(captures[ctr].Value[0]).ToString("X4"), ctr < captures.Count - 1 ? ", " : ""); Console.WriteLine(); - } + } } } // The example displays the following output: diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.characterclasses/cs/notcategory1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.characterclasses/cs/notcategory1.cs index f04938741a367..1838c5e656eb0 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.characterclasses/cs/notcategory1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.characterclasses/cs/notcategory1.cs @@ -7,7 +7,7 @@ public class Example public static void Main() { string pattern = @"(\P{Sc})+"; - + string[] values = { "$164,091.78", "£1,073,142.68", "73¢", "€120" }; foreach (string value in values) Console.WriteLine(Regex.Match(value, pattern).Value); diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.characterclasses/cs/positivecharclasses.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.characterclasses/cs/positivecharclasses.cs index 0074789c2dfbe..02c19612d5ed2 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.characterclasses/cs/positivecharclasses.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.characterclasses/cs/positivecharclasses.cs @@ -16,4 +16,4 @@ public static void Main() // The example displays the following output: // 'gray wolf ' // 'grey wall.' -// +// diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.characterclasses/cs/wordchar1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.characterclasses/cs/wordchar1.cs index 61e6d798538e2..b3b246d88ec0d 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.characterclasses/cs/wordchar1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.characterclasses/cs/wordchar1.cs @@ -7,17 +7,17 @@ public class Example public static void Main() { string pattern = @"(\w)\1"; - string[] words = { "trellis", "seer", "latter", "summer", + string[] words = { "trellis", "seer", "latter", "summer", "hoarse", "lesser", "aardvark", "stunned" }; foreach (string word in words) { Match match = Regex.Match(word, pattern); if (match.Success) - Console.WriteLine("'{0}' found in '{1}' at position {2}.", + Console.WriteLine("'{0}' found in '{1}' at position {2}.", match.Value, word, match.Index); else Console.WriteLine("No double characters in '{0}'.", word); - } + } } } // The example displays the following output: diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.options/cs/case1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.options/cs/case1.cs index 63fb1a6855fa0..19337bc5a6aaf 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.options/cs/case1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.options/cs/case1.cs @@ -12,7 +12,7 @@ public static void Main() Console.WriteLine("Found {0} at index {1}.", match.Value, match.Index); Console.WriteLine(); - foreach (Match match in Regex.Matches(input, pattern, + foreach (Match match in Regex.Matches(input, pattern, RegexOptions.IgnoreCase)) Console.WriteLine("Found {0} at index {1}.", match.Value, match.Index); } @@ -20,7 +20,7 @@ public static void Main() // The example displays the following output: // Found then at index 8. // Found them at index 18. -// +// // Found The at index 0. // Found then at index 8. // Found them at index 18. diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.options/cs/case2.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.options/cs/case2.cs index ba31b15f48862..733cf3056af1f 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.options/cs/case2.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.options/cs/case2.cs @@ -13,7 +13,7 @@ public static void Main() Console.WriteLine(); pattern = @"(?i)\bthe\w*\b"; - foreach (Match match in Regex.Matches(input, pattern, + foreach (Match match in Regex.Matches(input, pattern, RegexOptions.IgnoreCase)) Console.WriteLine("Found {0} at index {1}.", match.Value, match.Index); } @@ -22,7 +22,7 @@ public static void Main() // Found The at index 0. // Found then at index 8. // Found them at index 18. -// +// // Found The at index 0. // Found then at index 8. // Found them at index 18. diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.options/cs/culture1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.options/cs/culture1.cs index 547447eaac60e..ff3b5647eb04e 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.options/cs/culture1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.options/cs/culture1.cs @@ -13,18 +13,18 @@ public static void Main() } private static void ShowIllegalAccess() - { + { // CultureInfo defaultCulture = Thread.CurrentThread.CurrentCulture; Thread.CurrentThread.CurrentCulture = new CultureInfo("tr-TR"); - + string input = "file://c:/Documents.MyReport.doc"; string pattern = "FILE://"; - - Console.WriteLine("Culture-sensitive matching ({0} culture)...", + + Console.WriteLine("Culture-sensitive matching ({0} culture)...", Thread.CurrentThread.CurrentCulture.Name); if (Regex.IsMatch(input, pattern, RegexOptions.IgnoreCase)) - Console.WriteLine("URLs that access files are not allowed."); + Console.WriteLine("URLs that access files are not allowed."); else Console.WriteLine("Access to {0} is allowed.", input); @@ -36,17 +36,17 @@ private static void ShowIllegalAccess() } private static void ShowNoAccess() - { + { // CultureInfo defaultCulture = Thread.CurrentThread.CurrentCulture; Thread.CurrentThread.CurrentCulture = new CultureInfo("tr-TR"); - + string input = "file://c:/Documents.MyReport.doc"; string pattern = "FILE://"; - + Console.WriteLine("Culture-insensitive matching..."); - if (Regex.IsMatch(input, pattern, - RegexOptions.IgnoreCase | RegexOptions.CultureInvariant)) + if (Regex.IsMatch(input, pattern, + RegexOptions.IgnoreCase | RegexOptions.CultureInvariant)) Console.WriteLine("URLs that access files are not allowed."); else Console.WriteLine("Access to {0} is allowed.", input); diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.options/cs/determine1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.options/cs/determine1.cs index 7edcc8c633e94..3d20026197c43 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.options/cs/determine1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.options/cs/determine1.cs @@ -15,6 +15,6 @@ public static void Main() // if (rgx.Options == RegexOptions.None) Console.WriteLine("No options have been set."); - // + // } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.options/cs/ecmascript1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.options/cs/ecmascript1.cs index 9ae57c61df3f2..fe1b472b7ba5e 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.options/cs/ecmascript1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.options/cs/ecmascript1.cs @@ -15,7 +15,7 @@ public static void Main() Console.WriteLine("'{0}' matches the pattern.", value); else Console.WriteLine("{0} does not match the pattern.", value); - + Console.Write("ECMAScript matching: "); if (Regex.IsMatch(value, pattern, RegexOptions.ECMAScript)) Console.WriteLine("'{0}' matches the pattern.", value); @@ -28,7 +28,7 @@ public static void Main() // The example displays the following output: // Canonical matching: 'целый мир' matches the pattern. // ECMAScript matching: целый мир does not match the pattern. -// +// // Canonical matching: 'the whole world' matches the pattern. // ECMAScript matching: 'the whole world' matches the pattern. // diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.options/cs/ecmascript2.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.options/cs/ecmascript2.cs index 8d91b0e7ea88b..659e8bf41de7b 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.options/cs/ecmascript2.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.options/cs/ecmascript2.cs @@ -5,24 +5,24 @@ public class Example { static string pattern; - + public static void Main() { - string input = "aa aaaa aaaaaa "; + string input = "aa aaaa aaaaaa "; pattern = @"((a+)(\1) ?)+"; - + // Match input using canonical matching. AnalyzeMatch(Regex.Match(input, pattern)); - + // Match input using ECMAScript. AnalyzeMatch(Regex.Match(input, pattern, RegexOptions.ECMAScript)); - } - + } + private static void AnalyzeMatch(Match m) { if (m.Success) { - Console.WriteLine("'{0}' matches {1} at position {2}.", + Console.WriteLine("'{0}' matches {1} at position {2}.", pattern, m.Value, m.Index); int grpCtr = 0; foreach (Group grp in m.Groups) @@ -40,13 +40,13 @@ private static void AnalyzeMatch(Match m) else { Console.WriteLine("No match found."); - } + } Console.WriteLine(); } } // The example displays the following output: // No match found. -// +// // '((a+)(\1) ?)+' matches aa aaaa aaaaaa at position 0. // 0: 'aa aaaa aaaaaa ' // 0: 'aa aaaa aaaaaa ' diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.options/cs/example1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.options/cs/example1.cs index d7b19281d02aa..0c8ffaeb07210 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.options/cs/example1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.options/cs/example1.cs @@ -13,45 +13,45 @@ public static void Main() } private static void ShowOptionsArgument() - { + { // string pattern = @"d \w+ \s"; string input = "Dogs are decidedly good pets."; RegexOptions options = RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace; - + foreach (Match match in Regex.Matches(input, pattern, options)) Console.WriteLine("'{0}// found at index {1}.", match.Value, match.Index); // The example displays the following output: // 'Dogs // found at index 0. - // 'decidedly // found at index 9. + // 'decidedly // found at index 9. // } - + private static void ShowInlineOptions() { // string pattern = @"(?ix) d \w+ \s"; string input = "Dogs are decidedly good pets."; - + foreach (Match match in Regex.Matches(input, pattern)) Console.WriteLine("'{0}// found at index {1}.", match.Value, match.Index); // The example displays the following output: // 'Dogs // found at index 0. - // 'decidedly // found at index 9. + // 'decidedly // found at index 9. // } - + private static void ShowGroupOptions() { // string pattern = @"\b(?ix: d \w+)\s"; string input = "Dogs are decidedly good pets."; - + foreach (Match match in Regex.Matches(input, pattern)) Console.WriteLine("'{0}// found at index {1}.", match.Value, match.Index); // The example displays the following output: // 'Dogs // found at index 0. - // 'decidedly // found at index 9. + // 'decidedly // found at index 9. // } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.options/cs/explicit1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.options/cs/explicit1.cs index 21b2a4b6b1a7f..06e0b3702aa5c 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.options/cs/explicit1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.options/cs/explicit1.cs @@ -6,8 +6,8 @@ public class Example { public static void Main() { - string input = "This is the first sentence. Is it the beginning " + - "of a literary masterpiece? I think not. Instead, " + + string input = "This is the first sentence. Is it the beginning " + + "of a literary masterpiece? I think not. Instead, " + "it is a nonsensical paragraph."; string pattern = @"\b\(?((?>\w+),?\s?)+[\.!?]\)?"; Console.WriteLine("With implicit captures:"); @@ -113,7 +113,7 @@ public static void Main() // Capture 3: a // Capture 4: nonsensical // Capture 5: paragraph -// +// // With explicit captures only: // The match: This is the first sentence. // Group 0: This is the first sentence. diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.options/cs/explicit2.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.options/cs/explicit2.cs index b4858d229c8b6..101b2896ed23e 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.options/cs/explicit2.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.options/cs/explicit2.cs @@ -6,8 +6,8 @@ public class Example { public static void Main() { - string input = "This is the first sentence. Is it the beginning " + - "of a literary masterpiece? I think not. Instead, " + + string input = "This is the first sentence. Is it the beginning " + + "of a literary masterpiece? I think not. Instead, " + "it is a nonsensical paragraph."; string pattern = @"(?n)\b\(?((?>\w+),?\s?)+[\.!?]\)?"; diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.options/cs/explicit3.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.options/cs/explicit3.cs index 0658592db4e61..a366e5007e671 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.options/cs/explicit3.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.options/cs/explicit3.cs @@ -6,8 +6,8 @@ public class Example { public static void Main() { - string input = "This is the first sentence. Is it the beginning " + - "of a literary masterpiece? I think not. Instead, " + + string input = "This is the first sentence. Is it the beginning " + + "of a literary masterpiece? I think not. Instead, " + "it is a nonsensical paragraph."; string pattern = @"\b\(?(?n:(?>\w+),?\s?)+[\.!?]\)?"; diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.options/cs/multiline1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.options/cs/multiline1.cs index bdcd8afd514a7..55e756f49e063 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.options/cs/multiline1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.options/cs/multiline1.cs @@ -8,14 +8,14 @@ public class Example public static void Main() { SortedList scores = new SortedList(new DescendingComparer()); - - string input = "Joe 164\n" + - "Sam 208\n" + - "Allison 211\n" + - "Gwen 171\n"; + + string input = "Joe 164\n" + + "Sam 208\n" + + "Allison 211\n" + + "Gwen 171\n"; string pattern = @"^(\w+)\s(\d+)$"; bool matched = false; - + Console.WriteLine("Without Multiline option:"); foreach (Match match in Regex.Matches(input, pattern)) { @@ -32,7 +32,7 @@ public static void Main() foreach (Match match in Regex.Matches(input, pattern, RegexOptions.Multiline)) scores.Add(Int32.Parse(match.Groups[2].Value), (string) match.Groups[1].Value); - // List scores in descending order. + // List scores in descending order. foreach (KeyValuePair score in scores) Console.WriteLine("{0}: {1}", score.Value, score.Key); } @@ -42,13 +42,13 @@ public class DescendingComparer : IComparer { public int Compare(T x, T y) { - return Comparer.Default.Compare(x, y) * -1; + return Comparer.Default.Compare(x, y) * -1; } } // The example displays the following output: // Without Multiline option: // No matches. -// +// // With multiline option: // Allison: 211 // Sam: 208 diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.options/cs/multiline2.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.options/cs/multiline2.cs index 8b5a1738e01a4..a12f9fa8d27cd 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.options/cs/multiline2.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.options/cs/multiline2.cs @@ -8,17 +8,17 @@ public class Example public static void Main() { SortedList scores = new SortedList(new DescendingComparer()); - - string input = "Joe 164\n" + - "Sam 208\n" + - "Allison 211\n" + - "Gwen 171\n"; + + string input = "Joe 164\n" + + "Sam 208\n" + + "Allison 211\n" + + "Gwen 171\n"; string pattern = @"(?m)^(\w+)\s(\d+)\r*$"; foreach (Match match in Regex.Matches(input, pattern, RegexOptions.Multiline)) scores.Add(Convert.ToInt32(match.Groups[2].Value), match.Groups[1].Value); - // List scores in descending order. + // List scores in descending order. foreach (KeyValuePair score in scores) Console.WriteLine("{0}: {1}", score.Value, score.Key); } @@ -26,9 +26,9 @@ public static void Main() public class DescendingComparer : IComparer { - public int Compare(T x, T y) + public int Compare(T x, T y) { - return Comparer.Default.Compare(x, y) * -1; + return Comparer.Default.Compare(x, y) * -1; } } // The example displays the following output: diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.options/cs/righttoleft1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.options/cs/righttoleft1.cs index f135f38fab2ef..45f5129b3070a 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.options/cs/righttoleft1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.options/cs/righttoleft1.cs @@ -9,7 +9,7 @@ public static void Main() string pattern = @"\bb\w+\s"; string input = "builder rob rabble"; foreach (Match match in Regex.Matches(input, pattern, RegexOptions.RightToLeft)) - Console.WriteLine("'{0}' found at position {1}.", match.Value, match.Index); + Console.WriteLine("'{0}' found at position {1}.", match.Value, match.Index); } } // The example displays the following output: diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.options/cs/righttoleft2.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.options/cs/righttoleft2.cs index ba4bb6b0cf0d8..af91ec60fa888 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.options/cs/righttoleft2.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.options/cs/righttoleft2.cs @@ -8,7 +8,7 @@ public static void Main() { string[] inputs = { "1 May 1917", "June 16, 2003" }; string pattern = @"(?<=\d{1,2}\s)\w+,?\s\d{4}"; - + foreach (string input in inputs) { Match match = Regex.Match(input, pattern, RegexOptions.RightToLeft); diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.options/cs/singleline1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.options/cs/singleline1.cs index a18b8c9a86cd4..fe64c4ba7ebf1 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.options/cs/singleline1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.options/cs/singleline1.cs @@ -5,7 +5,7 @@ public class Example { public static void Main() - { + { string pattern = "(?s)^.+"; string input = "This is one line and" + Environment.NewLine + "this is the second."; diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.options/cs/whitespace1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.options/cs/whitespace1.cs index 58e9110cdac83..df71f9ae33b71 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.options/cs/whitespace1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.options/cs/whitespace1.cs @@ -6,8 +6,8 @@ public class Example { public static void Main() { - string input = "This is the first sentence. Is it the beginning " + - "of a literary masterpiece? I think not. Instead, " + + string input = "This is the first sentence. Is it the beginning " + + "of a literary masterpiece? I think not. Instead, " + "it is a nonsensical paragraph."; string pattern = @"\b \(? ( (?>\w+) ,?\s? )+ [\.!?] \)? # Matches an entire sentence."; diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.options/cs/whitespace2.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.options/cs/whitespace2.cs index 0fd85eb897aea..ed887b1b9f812 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.options/cs/whitespace2.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.options/cs/whitespace2.cs @@ -6,8 +6,8 @@ public class Example { public static void Main() { - string input = "This is the first sentence. Is it the beginning " + - "of a literary masterpiece? I think not. Instead, " + + string input = "This is the first sentence. Is it the beginning " + + "of a literary masterpiece? I think not. Instead, " + "it is a nonsensical paragraph."; string pattern = @"(?x)\b \(? ( (?>\w+) ,?\s? )+ [\.!?] \)? # Matches an entire sentence."; diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.substitutions/cs/after1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.substitutions/cs/after1.cs index 5af332affb396..b1e6c67d7dcc6 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.substitutions/cs/after1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.substitutions/cs/after1.cs @@ -13,7 +13,7 @@ public static void Main() foreach (Match match in Regex.Matches(input, pattern)) Console.WriteLine(" {0} at position {1}", match.Value, match.Index); Console.WriteLine("Input string: {0}", input); - Console.WriteLine("Output string: " + + Console.WriteLine("Output string: " + Regex.Replace(input, pattern, substitution)); } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.substitutions/cs/before1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.substitutions/cs/before1.cs index 0964e6aa68331..f7593afa79aa6 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.substitutions/cs/before1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.substitutions/cs/before1.cs @@ -14,7 +14,7 @@ public static void Main() Console.WriteLine(" {0} at position {1}", match.Value, match.Index); Console.WriteLine("Input string: {0}", input); - Console.WriteLine("Output string: " + + Console.WriteLine("Output string: " + Regex.Replace(input, pattern, substitution)); } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.substitutions/cs/dollarsign1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.substitutions/cs/dollarsign1.cs index ca0a61b2435ab..79a3c05907624 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.substitutions/cs/dollarsign1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.substitutions/cs/dollarsign1.cs @@ -17,9 +17,9 @@ public static void Main() string symbol = NumberFormatInfo.CurrentInfo.CurrencySymbol; // If symbol is a "$", add an extra "$". if (symbol == "$") symbol = "$$"; - + // Define regular expression pattern and replacement string. - string pattern = @"\b(\d+)(" + cSeparator + @"(\d+))?"; + string pattern = @"\b(\d+)(" + cSeparator + @"(\d+))?"; string replacement = "$1$2"; replacement = precedes ? symbol + " " + replacement : replacement + " " + symbol; foreach (string value in values) diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.substitutions/cs/entire1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.substitutions/cs/entire1.cs index bc6b47fd6d2f3..930554ccf524a 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.substitutions/cs/entire1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.substitutions/cs/entire1.cs @@ -10,8 +10,8 @@ public static void Main() string pattern = @"\d+"; string substitution = "$_"; Console.WriteLine("Original string: {0}", input); - Console.WriteLine("String with substitution: {0}", - Regex.Replace(input, pattern, substitution)); + Console.WriteLine("String with substitution: {0}", + Regex.Replace(input, pattern, substitution)); } } // The example displays the following output: diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.substitutions/cs/entirematch1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.substitutions/cs/entirematch1.cs index e51765dff9d66..9a81903d66805 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.substitutions/cs/entirematch1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.substitutions/cs/entirematch1.cs @@ -7,9 +7,9 @@ public class Example public static void Main() { string pattern = @"^(\w+\s?)+$"; - string[] titles = { "A Tale of Two Cities", - "The Hound of the Baskervilles", - "The Protestant Ethic and the Spirit of Capitalism", + string[] titles = { "A Tale of Two Cities", + "The Hound of the Baskervilles", + "The Protestant Ethic and the Spirit of Capitalism", "The Origin of Species" }; string replacement = "\"$&\""; foreach (string title in titles) diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.substitutions/cs/lastmatch1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.substitutions/cs/lastmatch1.cs index 2c09b942378a8..7161cfdbd2781 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.substitutions/cs/lastmatch1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex.language.substitutions/cs/lastmatch1.cs @@ -9,7 +9,7 @@ public static void Main() string pattern = @"\b(\w+)\s\1\b"; string substitution = "$+"; string input = "The the dog jumped over the fence fence."; - Console.WriteLine(Regex.Replace(input, pattern, substitution, + Console.WriteLine(Regex.Replace(input, pattern, substitution, RegexOptions.IgnoreCase)); } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex/cs/example.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex/cs/example.cs index c841c0dc4ee6c..dc2365f48a35b 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex/cs/example.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex/cs/example.cs @@ -9,14 +9,14 @@ public class Example public static void Main() { // Define text to be parsed. - string input = "Office expenses on 2/13/2008:\n" + - "Paper (500 sheets) $3.95\n" + - "Pencils (box of 10) $1.00\n" + - "Pens (box of 10) $4.49\n" + - "Erasers $2.19\n" + - "Ink jet printer $69.95\n\n" + - "Total Expenses $ 81.58\n"; - + string input = "Office expenses on 2/13/2008:\n" + + "Paper (500 sheets) $3.95\n" + + "Pencils (box of 10) $1.00\n" + + "Pens (box of 10) $4.49\n" + + "Erasers $2.19\n" + + "Ink jet printer $69.95\n\n" + + "Total Expenses $ 81.58\n"; + // Get current culture's NumberFormatInfo object. NumberFormatInfo nfi = CultureInfo.CurrentCulture.NumberFormat; // Assign needed property values to variables. @@ -26,34 +26,34 @@ public static void Main() string decimalSeparator = nfi.CurrencyDecimalSeparator; // Form regular expression pattern. - string pattern = Regex.Escape( symbolPrecedesIfPositive ? currencySymbol : "") + - @"\s*[-+]?" + "([0-9]{0,3}(" + groupSeparator + "[0-9]{3})*(" + - Regex.Escape(decimalSeparator) + "[0-9]+)?)" + - (! symbolPrecedesIfPositive ? currencySymbol : ""); + string pattern = Regex.Escape( symbolPrecedesIfPositive ? currencySymbol : "") + + @"\s*[-+]?" + "([0-9]{0,3}(" + groupSeparator + "[0-9]{3})*(" + + Regex.Escape(decimalSeparator) + "[0-9]+)?)" + + (! symbolPrecedesIfPositive ? currencySymbol : ""); Console.WriteLine( "The regular expression pattern is:"); - Console.WriteLine(" " + pattern); + Console.WriteLine(" " + pattern); // Get text that matches regular expression pattern. - MatchCollection matches = Regex.Matches(input, pattern, - RegexOptions.IgnorePatternWhitespace); - Console.WriteLine("Found {0} matches.", matches.Count); + MatchCollection matches = Regex.Matches(input, pattern, + RegexOptions.IgnorePatternWhitespace); + Console.WriteLine("Found {0} matches.", matches.Count); // Get numeric string, convert it to a value, and add it to List object. List expenses = new List(); - + foreach (Match match in matches) - expenses.Add(Decimal.Parse(match.Groups[1].Value)); + expenses.Add(Decimal.Parse(match.Groups[1].Value)); // Determine whether total is present and if present, whether it is correct. decimal total = 0; foreach (decimal value in expenses) total += value; - - if (total / 2 == expenses[expenses.Count - 1]) + + if (total / 2 == expenses[expenses.Count - 1]) Console.WriteLine("The expenses total {0:C2}.", expenses[expenses.Count - 1]); else Console.WriteLine("The expenses total {0:C2}.", total); - } + } } // The example displays the following output: // The regular expression pattern is: diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex/cs/example1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex/cs/example1.cs index 1b1ca4b8a39ea..57a6a4211c0a1 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex/cs/example1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex/cs/example1.cs @@ -7,7 +7,7 @@ public class Example public static void Main() { string pattern = "(Mr\\.? |Mrs\\.? |Miss |Ms\\.? )"; - string[] names = { "Mr. Henry Hunt", "Ms. Sara Samuels", + string[] names = { "Mr. Henry Hunt", "Ms. Sara Samuels", "Abraham Adams", "Ms. Nicole Norris" }; foreach (string name in names) Console.WriteLine(Regex.Replace(name, pattern, String.Empty)); diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex/cs/example2.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex/cs/example2.cs index 35abb0970f2e9..c70aba506dc16 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex/cs/example2.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regex/cs/example2.cs @@ -9,7 +9,7 @@ public static void Main() string pattern = @"\b(\w+?)\s\1\b"; string input = "This this is a nice day. What about this? This tastes good. I saw a a dog."; foreach (Match match in Regex.Matches(input, pattern, RegexOptions.IgnoreCase)) - Console.WriteLine("{0} (duplicates '{1}') at position {2}", + Console.WriteLine("{0} (duplicates '{1}') at position {2}", match.Value, match.Groups[1].Value, match.Index); } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.backtracking/cs/backtracking1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.backtracking/cs/backtracking1.cs index 936c60c5e4e5a..89aa2e0747b86 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.backtracking/cs/backtracking1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.backtracking/cs/backtracking1.cs @@ -9,7 +9,7 @@ public static void Main() string input = "needing a reed"; string pattern = @"e{2}\w\b"; foreach (Match match in Regex.Matches(input, pattern)) - Console.WriteLine("{0} found at position {1}", + Console.WriteLine("{0} found at position {1}", match.Value, match.Index); } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.backtracking/cs/backtracking2.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.backtracking/cs/backtracking2.cs index 2e6e1e056500e..93d1a5f766e8f 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.backtracking/cs/backtracking2.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.backtracking/cs/backtracking2.cs @@ -7,14 +7,14 @@ public class Example public static void Main() { string input = "Essential services are provided by regular expressions."; - string pattern = ".*(es)"; + string pattern = ".*(es)"; Match m = Regex.Match(input, pattern, RegexOptions.IgnoreCase); if (m.Success) { - Console.WriteLine("'{0}' found at position {1}", + Console.WriteLine("'{0}' found at position {1}", m.Value, m.Index); - Console.WriteLine("'es' found at position {0}", - m.Groups[1].Index); - } + Console.WriteLine("'es' found at position {0}", + m.Groups[1].Index); + } } } // 'Essential services are provided by regular expres' found at position 0 diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.backtracking/cs/backtracking3.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.backtracking/cs/backtracking3.cs index bb7f2bf62232a..8353edbb77a32 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.backtracking/cs/backtracking3.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.backtracking/cs/backtracking3.cs @@ -11,9 +11,9 @@ public static void Main() string[] inputs = { "aaaaaa", "aaaaa!" }; Regex rgx = new Regex(pattern); Stopwatch sw; - + foreach (string input in inputs) { - sw = Stopwatch.StartNew(); + sw = Stopwatch.StartNew(); Match match = rgx.Match(input); sw.Stop(); if (match.Success) diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.backtracking/cs/backtracking4.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.backtracking/cs/backtracking4.cs index 612043535692a..82b3a02e7956d 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.backtracking/cs/backtracking4.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.backtracking/cs/backtracking4.cs @@ -10,7 +10,7 @@ public static void Main() string input = "b51:4:1DB:9EE1:5:27d60:f44:D4:cd:E:5:0A5:4a:D24:41Ad:"; bool matched; Stopwatch sw; - + Console.WriteLine("With backtracking:"); string backPattern = "^(([0-9a-fA-F]{1,4}:)*([0-9a-fA-F]{1,4}))*(::)$"; sw = Stopwatch.StartNew(); @@ -18,7 +18,7 @@ public static void Main() sw.Stop(); Console.WriteLine("Match: {0} in {1}", Regex.IsMatch(input, backPattern), sw.Elapsed); Console.WriteLine(); - + Console.WriteLine("Without backtracking:"); string noBackPattern = "^((?>[0-9a-fA-F]{1,4}:)*(?>[0-9a-fA-F]{1,4}))*(::)$"; sw = Stopwatch.StartNew(); @@ -30,7 +30,7 @@ public static void Main() // The example displays output like the following: // With backtracking: // Match: False in 00:00:27.4282019 -// +// // Without backtracking: // Match: False in 00:00:00.0001391 // diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.backtracking/cs/backtracking5.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.backtracking/cs/backtracking5.cs index 5ac44ea992ae8..32d01d9a7f493 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.backtracking/cs/backtracking5.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.backtracking/cs/backtracking5.cs @@ -10,13 +10,13 @@ public static void Main() Stopwatch sw; string input = "test@contoso.com"; bool result; - + string pattern = @"^[0-9A-Z]([-.\w]*[0-9A-Z])?@"; sw = Stopwatch.StartNew(); result = Regex.IsMatch(input, pattern, RegexOptions.IgnoreCase); sw.Stop(); Console.WriteLine("Match: {0} in {1}", result, sw.Elapsed); - + string behindPattern = @"^[0-9A-Z][-.\w]*(?<=[0-9A-Z])@"; sw = Stopwatch.StartNew(); result = Regex.IsMatch(input, behindPattern, RegexOptions.IgnoreCase); diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.backtracking/cs/backtracking6.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.backtracking/cs/backtracking6.cs index 616f69540961b..39353ee3dfc5e 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.backtracking/cs/backtracking6.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.backtracking/cs/backtracking6.cs @@ -10,7 +10,7 @@ public static void Main() string input = "aaaaaaaaaaaaaaaaaaaaaa."; bool result; Stopwatch sw; - + string pattern = @"^(([A-Z]\w*)+\.)*[A-Z]\w*$"; sw = Stopwatch.StartNew(); result = Regex.IsMatch(input, pattern, RegexOptions.IgnoreCase); diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.bestpractices/cs/backtrack2.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.bestpractices/cs/backtrack2.cs index 8c794cc5c4621..f75b0b502e7ff 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.bestpractices/cs/backtrack2.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.bestpractices/cs/backtrack2.cs @@ -12,8 +12,8 @@ public static void Main() Console.WriteLine(match.Value); Console.WriteLine(); - - pattern = @"\b\p{Lu}(?>\w*)\b"; + + pattern = @"\b\p{Lu}(?>\w*)\b"; foreach (Match match in Regex.Matches(input, pattern)) Console.WriteLine(match.Value); } @@ -22,7 +22,7 @@ public static void Main() // This // Sentence // Capital -// +// // This // Sentence // Capital diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.bestpractices/cs/backtrack4.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.bestpractices/cs/backtrack4.cs index 360bc0303e3e3..7b01901eb74b0 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.bestpractices/cs/backtrack4.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.bestpractices/cs/backtrack4.cs @@ -8,14 +8,14 @@ public static void Main() { string pattern = @"^[0-9A-Z][-.\w]*(?<=[0-9A-Z])\$$"; string[] partNos = { "A1C$", "A4", "A4$", "A1603D$", "A1603D#" }; - + foreach (var input in partNos) { Match match = Regex.Match(input, pattern); if (match.Success) Console.WriteLine(match.Value); else Console.WriteLine("Match not found."); - } + } } } // The example displays the following output: diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.bestpractices/cs/compare1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.bestpractices/cs/compare1.cs index 03dfe247e31d1..2fdb6ad53cddc 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.bestpractices/cs/compare1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.bestpractices/cs/compare1.cs @@ -16,7 +16,7 @@ public static void Main() StreamReader inFile = new StreamReader(@".\Dreiser_TheFinancier.txt"); string input = inFile.ReadToEnd(); inFile.Close(); - + // Read first ten sentences with interpreted regex. Console.WriteLine("10 Sentences with Interpreted Regex:"); sw = Stopwatch.StartNew(); @@ -31,11 +31,11 @@ public static void Main() } sw.Stop(); Console.WriteLine(" {0} matches in {1}", ctr, sw.Elapsed); - + // Read first ten sentences with compiled regex. Console.WriteLine("10 Sentences with Compiled Regex:"); sw = Stopwatch.StartNew(); - Regex comp10 = new Regex(pattern, + Regex comp10 = new Regex(pattern, RegexOptions.Singleline | RegexOptions.Compiled); match = comp10.Match(input); for (ctr = 0; ctr <= 9; ctr++) { @@ -47,7 +47,7 @@ public static void Main() } sw.Stop(); Console.WriteLine(" {0} matches in {1}", ctr, sw.Elapsed); - + // Read all sentences with interpreted regex. Console.WriteLine("All Sentences with Interpreted Regex:"); sw = Stopwatch.StartNew(); @@ -61,11 +61,11 @@ public static void Main() } sw.Stop(); Console.WriteLine(" {0:N0} matches in {1}", matches, sw.Elapsed); - + // Read all sentences with compiled regex. Console.WriteLine("All Sentences with Compiled Regex:"); sw = Stopwatch.StartNew(); - Regex compAll = new Regex(pattern, + Regex compAll = new Regex(pattern, RegexOptions.Singleline | RegexOptions.Compiled); match = compAll.Match(input); matches = 0; @@ -75,7 +75,7 @@ public static void Main() match = match.NextMatch(); } sw.Stop(); - Console.WriteLine(" {0:N0} matches in {1}", matches, sw.Elapsed); + Console.WriteLine(" {0:N0} matches in {1}", matches, sw.Elapsed); } } // The example displays the following output: @@ -87,7 +87,7 @@ public static void Main() // 13,443 matches in 00:00:01.1929928 // All Sentences with Compiled Regex: // 13,443 matches in 00:00:00.7635869 -// +// // >compare1 // 10 Sentences with Interpreted Regex: // 10 matches in 00:00:00.0046914 diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.bestpractices/cs/compile2.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.bestpractices/cs/compile2.cs index dd722e86aab71..1608507b9e2e4 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.bestpractices/cs/compile2.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.bestpractices/cs/compile2.cs @@ -12,9 +12,9 @@ public static void Main() StreamReader inFile = new StreamReader(@".\Dreiser_TheFinancier.txt"); string input = inFile.ReadToEnd(); inFile.Close(); - + MatchCollection matches = pattern.Matches(input); - Console.WriteLine("Found {0:N0} sentences.", matches.Count); + Console.WriteLine("Found {0:N0} sentences.", matches.Count); } } // The example displays the following output: @@ -22,7 +22,7 @@ public static void Main() // // This code is here so that Parsnip will compile the example. -namespace Utilities.RegularExpressions +namespace Utilities.RegularExpressions { public class SentencePattern { diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.bestpractices/cs/design2.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.bestpractices/cs/design2.cs index 86e054fd8883a..5f3d223ae887c 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.bestpractices/cs/design2.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.bestpractices/cs/design2.cs @@ -7,29 +7,29 @@ public class Example { public static void Main() { - Stopwatch sw; - string[] addresses = { "AAAAAAAAAAA@contoso.com", + Stopwatch sw; + string[] addresses = { "AAAAAAAAAAA@contoso.com", "AAAAAAAAAAaaaaaaaaaa!@contoso.com" }; - // The following regular expression should not actually be used to + // The following regular expression should not actually be used to // validate an email address. string pattern = @"^[0-9A-Z]([-.\w]*[0-9A-Z])*$"; - string input; - + string input; + foreach (var address in addresses) { - string mailBox = address.Substring(0, address.IndexOf("@")); + string mailBox = address.Substring(0, address.IndexOf("@")); int index = 0; for (int ctr = mailBox.Length - 1; ctr >= 0; ctr--) { index++; - input = mailBox.Substring(ctr, index); + input = mailBox.Substring(ctr, index); sw = Stopwatch.StartNew(); Match m = Regex.Match(input, pattern, RegexOptions.IgnoreCase); sw.Stop(); if (m.Success) - Console.WriteLine("{0,2}. Matched '{1,25}' in {2}", + Console.WriteLine("{0,2}. Matched '{1,25}' in {2}", index, m.Value, sw.Elapsed); - else - Console.WriteLine("{0,2}. Failed '{1,25}' in {2}", + else + Console.WriteLine("{0,2}. Failed '{1,25}' in {2}", index, input, sw.Elapsed); } Console.WriteLine(); @@ -49,7 +49,7 @@ public static void Main() // 9. Matched ' AAAAAAAAA' in 00:00:00.0000045 // 10. Matched ' AAAAAAAAAA' in 00:00:00.0000045 // 11. Matched ' AAAAAAAAAAA' in 00:00:00.0000045 -// +// // 1. Failed ' !' in 00:00:00.0000447 // 2. Failed ' a!' in 00:00:00.0000071 // 3. Failed ' aa!' in 00:00:00.0000071 diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.bestpractices/cs/group1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.bestpractices/cs/group1.cs index 481269e845810..5e8b76009d04c 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.bestpractices/cs/group1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.bestpractices/cs/group1.cs @@ -8,9 +8,9 @@ public static void Main() { string input = "This is one sentence. This is another."; string pattern = @"\b(\w+[;,]?\s?)+[.?!]"; - + foreach (Match match in Regex.Matches(input, pattern)) { - Console.WriteLine("Match: '{0}' at index {1}.", + Console.WriteLine("Match: '{0}' at index {1}.", match.Value, match.Index); int grpCtr = 0; foreach (Group grp in match.Groups) { @@ -23,8 +23,8 @@ public static void Main() capCtr++; } grpCtr++; - } - Console.WriteLine(); + } + Console.WriteLine(); } } } @@ -37,7 +37,7 @@ public static void Main() // Capture 1: 'is ' at 5. // Capture 2: 'one ' at 8. // Capture 3: 'sentence' at 12. -// +// // Match: 'This is another.' at index 22. // Group 0: 'This is another.' at index 22. // Capture 0: 'This is another.' at 22. diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.bestpractices/cs/group2.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.bestpractices/cs/group2.cs index 5f1e19710b5a6..76460dd2b1aa0 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.bestpractices/cs/group2.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.bestpractices/cs/group2.cs @@ -8,9 +8,9 @@ public static void Main() { string input = "This is one sentence. This is another."; string pattern = @"\b(?:\w+[;,]?\s?)+[.?!]"; - + foreach (Match match in Regex.Matches(input, pattern)) { - Console.WriteLine("Match: '{0}' at index {1}.", + Console.WriteLine("Match: '{0}' at index {1}.", match.Value, match.Index); int grpCtr = 0; foreach (Group grp in match.Groups) { @@ -23,8 +23,8 @@ public static void Main() capCtr++; } grpCtr++; - } - Console.WriteLine(); + } + Console.WriteLine(); } } } @@ -32,7 +32,7 @@ public static void Main() // Match: 'This is one sentence.' at index 0. // Group 0: 'This is one sentence.' at index 0. // Capture 0: 'This is one sentence.' at 0. -// +// // Match: 'This is another.' at index 22. // Group 0: 'This is another.' at index 22. // Capture 0: 'This is another.' at 22. diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.bestpractices/cs/static1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.bestpractices/cs/static1.cs index 00cc7fd38bd74..b8eb6a268674f 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.bestpractices/cs/static1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.bestpractices/cs/static1.cs @@ -16,11 +16,11 @@ public static bool IsValidCurrency(string currencyValue) // public class CurrencyForm : Form -{ +{ Button OKButton; TextBox sourceCurrency; Label status; - + public CurrencyForm() { sourceCurrency = new TextBox(); @@ -29,7 +29,7 @@ public CurrencyForm() sourceCurrency.Text = String.Empty; sourceCurrency.TextChanged += new System.EventHandler(this.sourceCurrency_TextChanged); this.Controls.Add(sourceCurrency); - + OKButton = new Button(); OKButton.Location = new Point(100, 150); OKButton.Size = new Size(75, 25); @@ -45,7 +45,7 @@ public CurrencyForm() status.Anchor = AnchorStyles.Bottom; this.Controls.Add(status); } - + public static void Main() { Form frm = new CurrencyForm(); @@ -53,14 +53,14 @@ public static void Main() } private void PerformConversion() {} - + public void sourceCurrency_TextChanged(object sender, EventArgs e) - { - status.Text = ""; - } - - // - public void OKButton_Click(object sender, EventArgs e) + { + status.Text = ""; + } + + // + public void OKButton_Click(object sender, EventArgs e) { if (! String.IsNullOrEmpty(sourceCurrency.Text)) if (RegexLib.IsValidCurrency(sourceCurrency.Text)) diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.bestpractices/cs/static2.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.bestpractices/cs/static2.cs index 477055c0487e2..27457bd1c1894 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.bestpractices/cs/static2.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.bestpractices/cs/static2.cs @@ -10,17 +10,17 @@ public class RegexLib public static bool IsValidCurrency(string currencyValue) { string pattern = @"\p{Sc}+\s*\d+"; - return Regex.IsMatch(currencyValue, pattern); + return Regex.IsMatch(currencyValue, pattern); } } // public class CurrencyForm : Form -{ +{ Button OKButton; TextBox sourceCurrency; Label status; - + public CurrencyForm() { sourceCurrency = new TextBox(); @@ -29,7 +29,7 @@ public CurrencyForm() sourceCurrency.Text = String.Empty; sourceCurrency.TextChanged += new System.EventHandler(this.sourceCurrency_TextChanged); this.Controls.Add(sourceCurrency); - + OKButton = new Button(); OKButton.Location = new Point(100, 150); OKButton.Size = new Size(75, 25); @@ -45,7 +45,7 @@ public CurrencyForm() status.Anchor = AnchorStyles.Bottom; this.Controls.Add(status); } - + public static void Main() { Form frm = new CurrencyForm(); @@ -53,13 +53,13 @@ public static void Main() } private void PerformConversion() {} - + public void sourceCurrency_TextChanged(object sender, EventArgs e) - { - status.Text = ""; - } - - public void OKButton_Click(object sender, EventArgs e) + { + status.Text = ""; + } + + public void OKButton_Click(object sender, EventArgs e) { if (! String.IsNullOrEmpty(sourceCurrency.Text)) if (RegexLib.IsValidCurrency(sourceCurrency.Text)) diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.bestpractices/cs/timeout1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.bestpractices/cs/timeout1.cs index 066c3a7e271dd..904224eb2adf3 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.bestpractices/cs/timeout1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.bestpractices/cs/timeout1.cs @@ -13,14 +13,14 @@ public static void Main() try { var info = util.GetWordData(title); Console.WriteLine("Words: {0:N0}", info.Item1); - Console.WriteLine("Average Word Length: {0:N2} characters", info.Item2); + Console.WriteLine("Average Word Length: {0:N2} characters", info.Item2); } catch (IOException e) { Console.WriteLine("IOException reading file '{0}'", title); Console.WriteLine(e.Message); } catch (RegexMatchTimeoutException e) { - Console.WriteLine("The operation timed out after {0:N0} milliseconds", + Console.WriteLine("The operation timed out after {0:N0} milliseconds", e.MatchTimeout.TotalMilliseconds); } } @@ -29,15 +29,15 @@ public static void Main() public class RegexUtilities { public Tuple GetWordData(string filename) - { + { const int MAX_TIMEOUT = 1000; // Maximum timeout interval in milliseconds. const int INCREMENT = 350; // Milliseconds increment of timeout. - + List exclusions = new List( new string[] { "a", "an", "the" }); int[] wordLengths = new int[29]; // Allocate an array of more than ample size. string input = null; StreamReader sr = null; - try { + try { sr = new StreamReader(filename); input = sr.ReadToEnd(); } @@ -49,30 +49,30 @@ public Tuple GetWordData(string filename) throw new IOException(e.Message, e); } finally { - if (sr != null) sr.Close(); + if (sr != null) sr.Close(); } int timeoutInterval = INCREMENT; bool init = false; Regex rgx = null; Match m = null; - int indexPos = 0; + int indexPos = 0; do { try { if (! init) { - rgx = new Regex(@"\b\w+\b", RegexOptions.None, + rgx = new Regex(@"\b\w+\b", RegexOptions.None, TimeSpan.FromMilliseconds(timeoutInterval)); m = rgx.Match(input, indexPos); init = true; } - else { + else { m = m.NextMatch(); } - if (m.Success) { + if (m.Success) { if ( !exclusions.Contains(m.Value.ToLower())) wordLengths[m.Value.Length]++; - indexPos += m.Length + 1; + indexPos += m.Length + 1; } } catch (RegexMatchTimeoutException e) { @@ -82,15 +82,15 @@ public Tuple GetWordData(string filename) } else { // Rethrow the exception. - throw; - } - } + throw; + } + } } while (m.Success); - + // If regex completed successfully, calculate number of words and average length. - int nWords = 0; + int nWords = 0; long totalLength = 0; - + for (int ctr = wordLengths.GetLowerBound(0); ctr <= wordLengths.GetUpperBound(0); ctr++) { nWords += wordLengths[ctr]; totalLength += ctr * wordLengths[ctr]; diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.design/cs/conditional1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.design/cs/conditional1.cs index 403b5006d4bbc..a2b162d3419ef 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.design/cs/conditional1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.design/cs/conditional1.cs @@ -6,21 +6,21 @@ public class Example { public static void Main() { - string input = " This is not for public consumption." + Environment.NewLine + - "But this is for public consumption." + Environment.NewLine + - " Again, this is confidential.\n"; + string input = " This is not for public consumption." + Environment.NewLine + + "But this is for public consumption." + Environment.NewLine + + " Again, this is confidential.\n"; string pattern = @"^(?\\s)?(?(Pvt)((\w+\p{P}?\s)+)|((\w+\p{P}?\s)+))\r?$"; string publicDocument = null, privateDocument = null; - + foreach (Match match in Regex.Matches(input, pattern, RegexOptions.Multiline)) { if (match.Groups[1].Success) { privateDocument += match.Groups[1].Value + "\n"; } else { - publicDocument += match.Groups[3].Value + "\n"; + publicDocument += match.Groups[3].Value + "\n"; privateDocument += match.Groups[3].Value + "\n"; - } + } } Console.WriteLine("Private Document:"); @@ -34,7 +34,7 @@ public static void Main() // This is not for public consumption. // But this is for public consumption. // Again, this is confidential. -// +// // Public Document: // But this is for public consumption. // diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.design/cs/lazy1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.design/cs/lazy1.cs index 49dba977fb1df..3a76e5923b5a6 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.design/cs/lazy1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.design/cs/lazy1.cs @@ -10,19 +10,19 @@ public static void Main() string lazyPattern = @".+?(\d+)\."; string input = "This sentence ends with the number 107325."; Match match; - + // Match using greedy quantifier .+. match = Regex.Match(input, greedyPattern); if (match.Success) - Console.WriteLine("Number at end of sentence (greedy): {0}", + Console.WriteLine("Number at end of sentence (greedy): {0}", match.Groups[1].Value); else Console.WriteLine("{0} finds no match.", greedyPattern); - + // Match using lazy quantifier .+?. match = Regex.Match(input, lazyPattern); if (match.Success) - Console.WriteLine("Number at end of sentence (lazy): {0}", + Console.WriteLine("Number at end of sentence (lazy): {0}", match.Groups[1].Value); else Console.WriteLine("{0} finds no match.", lazyPattern); diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.design/cs/lookbehind1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.design/cs/lookbehind1.cs index f39b4b0cb5174..1ebc5daaa94f8 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.design/cs/lookbehind1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.design/cs/lookbehind1.cs @@ -6,7 +6,7 @@ public class Example { public static void Main() { - string[] inputs = { "jack.sprat", "dog#", "dog#1", "me.myself", + string[] inputs = { "jack.sprat", "dog#", "dog#1", "me.myself", "me.myself!" }; string pattern = @"^[A-Z0-9]([-!#$%&'.*+/=?^`{}|~\w])*(?<=[A-Z0-9])$"; foreach (string input in inputs) { diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.design/cs/nonbacktracking1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.design/cs/nonbacktracking1.cs index 55419e0c5c87e..326a715d331cb 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.design/cs/nonbacktracking1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.design/cs/nonbacktracking1.cs @@ -14,15 +14,15 @@ public static void Main() Console.WriteLine("Input: {0}", input); match = Regex.Match(input, nonbacktrackingPattern); Console.WriteLine(" Pattern: {0}", nonbacktrackingPattern); - if (match.Success) { + if (match.Success) { Console.WriteLine(" Match: {0}", match.Value); Console.WriteLine(" Group 1: {0}", match.Groups[1].Value); } else { Console.WriteLine(" Match failed."); - } + } } - Console.WriteLine(); + Console.WriteLine(); } } // The example displays the following output: diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.design/cs/nonbacktracking2.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.design/cs/nonbacktracking2.cs index e256fbb975f9f..b3cedbccad3a9 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.design/cs/nonbacktracking2.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.design/cs/nonbacktracking2.cs @@ -14,15 +14,15 @@ public static void Main() Console.WriteLine("Input: {0}", input); match = Regex.Match(input, backtrackingPattern); Console.WriteLine(" Pattern: {0}", backtrackingPattern); - if (match.Success) { + if (match.Success) { Console.WriteLine(" Match: {0}", match.Value); Console.WriteLine(" Group 1: {0}", match.Groups[1].Value); } else { Console.WriteLine(" Match failed."); - } + } } - Console.WriteLine(); + Console.WriteLine(); } } // The example displays the following output: diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.design/cs/rtl1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.design/cs/rtl1.cs index 2b9bcd0595508..ef3e3127bb1cc 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.design/cs/rtl1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.design/cs/rtl1.cs @@ -9,19 +9,19 @@ public static void Main() string greedyPattern = @".+(\d+)\."; string input = "This sentence ends with the number 107325."; Match match; - + // Match from left-to-right using lazy quantifier .+?. match = Regex.Match(input, greedyPattern); if (match.Success) - Console.WriteLine("Number at end of sentence (left-to-right): {0}", + Console.WriteLine("Number at end of sentence (left-to-right): {0}", match.Groups[1].Value); else Console.WriteLine("{0} finds no match.", greedyPattern); - + // Match from right-to-left using greedy quantifier .+. match = Regex.Match(input, greedyPattern, RegexOptions.RightToLeft); if (match.Success) - Console.WriteLine("Number at end of sentence (right-to-left): {0}", + Console.WriteLine("Number at end of sentence (right-to-left): {0}", match.Groups[1].Value); else Console.WriteLine("{0} finds no match.", greedyPattern); @@ -30,4 +30,4 @@ public static void Main() // The example displays the following output: // Number at end of sentence (left-to-right): 5 // Number at end of sentence (right-to-left): 107325 -// +// diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.objectmodel/cs/capture1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.objectmodel/cs/capture1.cs index 265b1ebaf1a02..b4ea755ee3f11 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.objectmodel/cs/capture1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.objectmodel/cs/capture1.cs @@ -6,14 +6,14 @@ public class Example { public static void Main() { - string input = "Miami,78;Chicago,62;New York,67;San Francisco,59;Seattle,58;"; + string input = "Miami,78;Chicago,62;New York,67;San Francisco,59;Seattle,58;"; string pattern = @"((\w+(\s\w+)*),(\d+);)+"; Match match = Regex.Match(input, pattern); if (match.Success) { Console.WriteLine("Current temperatures:"); for (int ctr = 0; ctr < match.Groups[2].Captures.Count; ctr++) - Console.WriteLine("{0,-20} {1,3}", match.Groups[2].Captures[ctr].Value, + Console.WriteLine("{0,-20} {1,3}", match.Groups[2].Captures[ctr].Value, match.Groups[4].Captures[ctr].Value); } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.objectmodel/cs/capturecollection1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.objectmodel/cs/capturecollection1.cs index cf7de8553524b..77f335f970c31 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.objectmodel/cs/capturecollection1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.objectmodel/cs/capturecollection1.cs @@ -8,21 +8,21 @@ public static void Main() { string pattern = "((a(b))c)+"; string input = "abcabcabc"; - + Match match = Regex.Match(input, pattern); if (match.Success) { - Console.WriteLine("Match: '{0}' at position {1}", + Console.WriteLine("Match: '{0}' at position {1}", match.Value, match.Index); GroupCollection groups = match.Groups; for (int ctr = 0; ctr < groups.Count; ctr++) { - Console.WriteLine(" Group {0}: '{1}' at position {2}", + Console.WriteLine(" Group {0}: '{1}' at position {2}", ctr, groups[ctr].Value, groups[ctr].Index); CaptureCollection captures = groups[ctr].Captures; for (int ctr2 = 0; ctr2 < captures.Count; ctr2++) { - Console.WriteLine(" Capture {0}: '{1}' at position {2}", + Console.WriteLine(" Capture {0}: '{1}' at position {2}", ctr2, captures[ctr2].Value, captures[ctr2].Index); - } + } } } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.objectmodel/cs/groupsyntax1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.objectmodel/cs/groupsyntax1.cs index af39b21abfcae..e1e9b710ec144 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.objectmodel/cs/groupsyntax1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.objectmodel/cs/groupsyntax1.cs @@ -10,7 +10,7 @@ public static void Main() if (match.Success) { // - Group group = match.Groups[ctr]; + Group group = match.Groups[ctr]; // } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.objectmodel/cs/lastcapture1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.objectmodel/cs/lastcapture1.cs index 98fbfe1387ab1..02c0dc98a3e27 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.objectmodel/cs/lastcapture1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.objectmodel/cs/lastcapture1.cs @@ -13,7 +13,7 @@ public static void Main() { Console.WriteLine("Match: " + match.Value); Console.WriteLine("Group 2: " + match.Groups[2].Value); - } + } } } // The example displays the following output: diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.objectmodel/cs/match1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.objectmodel/cs/match1.cs index 12a787316df6d..38c9c237a6268 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.objectmodel/cs/match1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.objectmodel/cs/match1.cs @@ -6,15 +6,15 @@ public class Example { public static void Main() { - string input = "This is a a farm that that raises dairy cattle."; + string input = "This is a a farm that that raises dairy cattle."; string pattern = @"\b(\w+)\W+(\1)\b"; Match match = Regex.Match(input, pattern); while (match.Success) { - Console.WriteLine("Duplicate '{0}' found at position {1}.", + Console.WriteLine("Duplicate '{0}' found at position {1}.", match.Groups[1].Value, match.Groups[2].Index); match = match.NextMatch(); - } + } } } // The example displays the following output: diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.objectmodel/cs/match2.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.objectmodel/cs/match2.cs index 67755734b2520..1349eed1d702b 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.objectmodel/cs/match2.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.objectmodel/cs/match2.cs @@ -9,7 +9,7 @@ public static void Main() string pattern = "abc"; string input = "abc123abc456abc789"; foreach (Match match in Regex.Matches(input, pattern)) - Console.WriteLine("{0} found at position {1}.", + Console.WriteLine("{0} found at position {1}.", match.Value, match.Index); } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.objectmodel/cs/match3.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.objectmodel/cs/match3.cs index 0e8b92882d097..c5544923e0f48 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.objectmodel/cs/match3.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.objectmodel/cs/match3.cs @@ -11,10 +11,10 @@ public static void Main() Match match = Regex.Match(input, pattern); while (match.Success) { - Console.WriteLine("{0} found at position {1}.", + Console.WriteLine("{0} found at position {1}.", match.Value, match.Index); - match = match.NextMatch(); - } + match = match.NextMatch(); + } } } // The example displays the following output: diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.objectmodel/cs/matchcollection1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.objectmodel/cs/matchcollection1.cs index 259160eee27c9..f10e562af0d84 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.objectmodel/cs/matchcollection1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.objectmodel/cs/matchcollection1.cs @@ -10,7 +10,7 @@ public static void Main() MatchCollection matches; List results = new List(); List matchposition = new List(); - + // Create a new Regex object and define the regular expression. Regex r = new Regex("abc"); // Use the Matches method to find all matches in the input string. @@ -25,8 +25,8 @@ public static void Main() } // List the results. for (int ctr = 0; ctr < results.Count; ctr++) - Console.WriteLine("'{0}' found at position {1}.", - results[ctr], matchposition[ctr]); + Console.WriteLine("'{0}' found at position {1}.", + results[ctr], matchposition[ctr]); } } // The example displays the following output: diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.objectmodel/cs/matches1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.objectmodel/cs/matches1.cs index dc77b4e25a2e4..a42f7d785a21b 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.objectmodel/cs/matches1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.objectmodel/cs/matches1.cs @@ -6,10 +6,10 @@ public class Example { public static void Main() { - string input = "This is a a farm that that raises dairy cattle."; + string input = "This is a a farm that that raises dairy cattle."; string pattern = @"\b(\w+)\W+(\1)\b"; foreach (Match match in Regex.Matches(input, pattern)) - Console.WriteLine("Duplicate '{0}' found at position {1}.", + Console.WriteLine("Duplicate '{0}' found at position {1}.", match.Groups[1].Value, match.Groups[2].Index); } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.objectmodel/cs/replace1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.objectmodel/cs/replace1.cs index 698d04c0d73b9..3aa8126e334c9 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.objectmodel/cs/replace1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.objectmodel/cs/replace1.cs @@ -7,9 +7,9 @@ public class Example public static void Main() { string pattern = @"\b\d+\.\d{2}\b"; - string replacement = "$$$&"; + string replacement = "$$$&"; string input = "Total Cost: 103.64"; - Console.WriteLine(Regex.Replace(input, pattern, replacement)); + Console.WriteLine(Regex.Replace(input, pattern, replacement)); } } // The example displays the following output: diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.objectmodel/cs/result1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.objectmodel/cs/result1.cs index b4ba14458592e..0d798ef575db2 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.objectmodel/cs/result1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.objectmodel/cs/result1.cs @@ -7,7 +7,7 @@ public class Example public static void Main() { string pattern = @"\b\d+(,\d{3})*\.\d{2}\b"; - string input = "16.32\n194.03\n1,903,672.08"; + string input = "16.32\n194.03\n1,903,672.08"; foreach (Match match in Regex.Matches(input, pattern)) Console.WriteLine(match.Result("$$ $&")); diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.objectmodel/cs/split1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.objectmodel/cs/split1.cs index e7dd24e959bc5..a61ff41b28903 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.objectmodel/cs/split1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.objectmodel/cs/split1.cs @@ -12,7 +12,7 @@ public static void Main() { if (! String.IsNullOrEmpty(item)) Console.WriteLine(item); - } + } } } // The example displays the following output: diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.objectmodel/cs/validate1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.objectmodel/cs/validate1.cs index dcd367c447e2f..c45e75dca887f 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.objectmodel/cs/validate1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.regularexpressions.objectmodel/cs/validate1.cs @@ -11,7 +11,7 @@ public static void Main() foreach (string value in values) { if (Regex.IsMatch(value, pattern)) Console.WriteLine("{0} is a valid SSN.", value); - else + else Console.WriteLine("{0}: Invalid", value); } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.locating/cs/assemblyinfo.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.locating/cs/assemblyinfo.cs index ea676eb943841..761ef9431cb67 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.locating/cs/assemblyinfo.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.locating/cs/assemblyinfo.cs @@ -3,7 +3,7 @@ using System.Runtime.InteropServices; using System.Resources; -// General Information about an assembly is controlled through the following +// General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("LocatingCS1")] @@ -15,8 +15,8 @@ [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] @@ -26,11 +26,11 @@ // Version information for an assembly consists of the following four values: // // Major Version -// Minor Version +// Minor Version // Build Number // Revision // -// You can specify all the values or you can default the Build and Revision Numbers +// You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.locating/cs/program.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.locating/cs/program.cs index cc1c9fcbced98..69ea7d11b6c5b 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.locating/cs/program.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.locating/cs/program.cs @@ -20,8 +20,8 @@ static void Main() CultureInfo newCulture = new CultureInfo(cultures[cultureNdx]); Thread.CurrentThread.CurrentCulture = newCulture; Thread.CurrentThread.CurrentUICulture = newCulture; - ResourceManager rm = new ResourceManager("Example.Greetings", - typeof(Example).Assembly); + ResourceManager rm = new ResourceManager("Example.Greetings", + typeof(Example).Assembly); string greeting = String.Format("The current culture is {0}.\n{1}", Thread.CurrentThread.CurrentUICulture.Name, rm.GetString("HelloString")); diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.packaging/cs/example1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.packaging/cs/example1.cs index 9707155433b55..bce0722caf446 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.packaging/cs/example1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.packaging/cs/example1.cs @@ -9,10 +9,10 @@ public class Example { public static void Main() { - ResourceManager rm = new ResourceManager("resources", + ResourceManager rm = new ResourceManager("resources", typeof(Example).Assembly); string greeting = rm.GetString("Greeting"); - Console.WriteLine(greeting); + Console.WriteLine(greeting); } } // diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.portable/cs/program.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.portable/cs/program.cs index b7fb0b284b052..883a7064edf9c 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.portable/cs/program.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.portable/cs/program.cs @@ -4,7 +4,7 @@ using System; using System.Collections.Generic; using MyCompany.Employees; - + class Program { static void Main() @@ -37,7 +37,7 @@ static void Main() Console.ReadLine(); } - private static List> InitializeData() + private static List> InitializeData() { List> employees = new List>(); var t1 = Tuple.Create("John", "16302", new DateTime(1954, 8, 18), new DateTime(2006, 9, 8)); diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.portable/cs/program2.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.portable/cs/program2.cs index d51b6efd2d989..20a7ea0454707 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.portable/cs/program2.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.portable/cs/program2.cs @@ -6,12 +6,12 @@ using System.Globalization; using MyCompany.Employees; - + class Program { static void Main(string[] args) { - + // Get the data from some data source. var employees = InitializeData(); @@ -40,7 +40,7 @@ static void Main(string[] args) Console.ReadLine(); } - private static List> InitializeData() + private static List> InitializeData() { List> employees = new List>(); var t1 = Tuple.Create("John", "16302", new DateTime(1954, 8, 18), new DateTime(2006, 9, 8)); diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.portable/cs/uilibrary.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.portable/cs/uilibrary.cs index ec24232450bcf..dfcf4a770aab7 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.portable/cs/uilibrary.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.portable/cs/uilibrary.cs @@ -1,4 +1,4 @@ -// +// using System; using System.Resources; using MyCompany.Employees; @@ -13,7 +13,7 @@ public class UILibrary public static string GetTitle() { - string retval = LibResources.Born; + string retval = LibResources.Born; if (String.IsNullOrEmpty(retval)) retval = ""; @@ -43,18 +43,18 @@ public static int[] GetFieldLengths() } // -namespace MyCompany.Employees +namespace MyCompany.Employees { public class LibResources { - + private static global::System.Resources.ResourceManager resourceMan; - + private static global::System.Globalization.CultureInfo resourceCulture; - + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal LibResources() { } - + /// /// Returns the cached ResourceManager instance used by this class. /// @@ -68,7 +68,7 @@ internal LibResources() { return resourceMan; } } - + /// /// Overrides the current thread's CurrentUICulture property for all /// resource lookups using this strongly typed resource class. @@ -82,7 +82,7 @@ internal LibResources() { resourceCulture = value; } } - + /// /// Looks up a localized string similar to Birthdate. /// @@ -91,7 +91,7 @@ public static string Born { return ResourceManager.GetString("Born", resourceCulture); } } - + /// /// Looks up a localized string similar to 12. /// @@ -100,7 +100,7 @@ public static string BornLength { return ResourceManager.GetString("BornLength", resourceCulture); } } - + /// /// Looks up a localized string similar to Hire Date. /// @@ -109,7 +109,7 @@ public static string Hired { return ResourceManager.GetString("Hired", resourceCulture); } } - + /// /// Looks up a localized string similar to 12. /// @@ -118,7 +118,7 @@ public static string HiredLength { return ResourceManager.GetString("HiredLength", resourceCulture); } } - + /// /// Looks up a localized string similar to ID. /// @@ -127,7 +127,7 @@ public static string ID { return ResourceManager.GetString("ID", resourceCulture); } } - + /// /// Looks up a localized string similar to 12. /// @@ -136,7 +136,7 @@ public static string IDLength { return ResourceManager.GetString("IDLength", resourceCulture); } } - + /// /// Looks up a localized string similar to Name. /// @@ -145,7 +145,7 @@ public static string Name { return ResourceManager.GetString("Name", resourceCulture); } } - + /// /// Looks up a localized string similar to 25. /// @@ -154,7 +154,7 @@ public static string NameLength { return ResourceManager.GetString("NameLength", resourceCulture); } } - + /// /// Looks up a localized string similar to Employee Database. /// diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.portablemetro/cs/assemblyinfo.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.portablemetro/cs/assemblyinfo.cs index 9281da6680dc2..105e28163523f 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.portablemetro/cs/assemblyinfo.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.portablemetro/cs/assemblyinfo.cs @@ -2,7 +2,7 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following +// General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("ConsumerCS")] @@ -17,11 +17,11 @@ // Version information for an assembly consists of the following four values: // // Major Version -// Minor Version +// Minor Version // Build Number // Revision // -// You can specify all the values or you can default the Build and Revision Numbers +// You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.portablemetro/cs/blankpage.xaml.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.portablemetro/cs/blankpage.xaml.cs index 02c33f9524c3c..60bfa3af53318 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.portablemetro/cs/blankpage.xaml.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.portablemetro/cs/blankpage.xaml.cs @@ -1,4 +1,4 @@ -// +// using System; using System.Collections.Generic; using Windows.UI.Xaml; @@ -40,7 +40,7 @@ static public void DisplayData(Windows.UI.Xaml.Controls.TextBlock outputBlock) { // Get the data from some data source. var employees = InitializeData(); - outputBlock.FontFamily = new FontFamily("Courier New"); + outputBlock.FontFamily = new FontFamily("Courier New"); // Display application title. string title = UILibrary.GetTitle(); outputBlock.Text += title + Environment.NewLine + Environment.NewLine; diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.portablemetro/cs/richtextcolumns.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.portablemetro/cs/richtextcolumns.cs index 9af1377b1b2fe..563cf4528adf7 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.portablemetro/cs/richtextcolumns.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.portablemetro/cs/richtextcolumns.cs @@ -24,7 +24,7 @@ namespace ConsumerCS.Common /// /// /// - /// + /// /// /// /// diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.portablemetroloc/cs/assemblyinfo.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.portablemetroloc/cs/assemblyinfo.cs index 642152e67916c..54136bf6c718c 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.portablemetroloc/cs/assemblyinfo.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.portablemetroloc/cs/assemblyinfo.cs @@ -2,7 +2,7 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following +// General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("LocConsumerCS")] @@ -17,11 +17,11 @@ // Version information for an assembly consists of the following four values: // // Major Version -// Minor Version +// Minor Version // Build Number // Revision // -// You can specify all the values or you can default the Build and Revision Numbers +// You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.portablemetroloc/cs/blankpage.xaml.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.portablemetroloc/cs/blankpage.xaml.cs index f2f2ba382e739..0214ee3f1be81 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.portablemetroloc/cs/blankpage.xaml.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.portablemetroloc/cs/blankpage.xaml.cs @@ -33,12 +33,12 @@ public static void Demo(TextBlock outputBlock) // Set the application preferences. ApplicationLanguages.PrimaryLanguageOverride = "fr-FR"; - // Get the data from some data source. + // Get the data from some data source. var employees = InitializeData(); outputBlock.FontFamily = new FontFamily("Courier New"); // Display application title. string title = UILibrary.GetTitle(); - outputBlock.Text += title + Environment.NewLine + Environment.NewLine; + outputBlock.Text += title + Environment.NewLine + Environment.NewLine; // Retrieve resources. string[] fields = UILibrary.GetFieldNames(); diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.portablemetroloc/cs/richtextcolumns.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.portablemetroloc/cs/richtextcolumns.cs index fc4617c90436e..6947e008494ad 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.portablemetroloc/cs/richtextcolumns.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.portablemetroloc/cs/richtextcolumns.cs @@ -24,7 +24,7 @@ namespace LocConsumerCS.Common /// /// /// - /// + /// /// /// /// diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.resources/cs/resources1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.resources/cs/resources1.cs index 116d9fb3bf6f4..3d8d449e9f2ec 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.resources/cs/resources1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.resources/cs/resources1.cs @@ -10,14 +10,14 @@ private int carYear; private int carDoors; private int carCylinders; - + public Automobile(string make, string model, int year) : this(make, model, year, 0, 0) { } - - public Automobile(string make, string model, int year, + + public Automobile(string make, string model, int year, int doors, int cylinders) - { + { this.carMake = make; this.carModel = model; this.carYear = year; @@ -27,25 +27,25 @@ public Automobile(string make, string model, int year, public string Make { get { return this.carMake; } - } - + } + public string Model { - get { return this.carModel; } - } - + get { return this.carModel; } + } + public int Year { get { return this.carYear; } - } - + } + public int Doors { - get { + get { return this.carDoors; } - } - + } + public int Cylinders { - get { + get { return this.carCylinders; } - } + } } public class Example @@ -64,9 +64,9 @@ public static void Main() rw.AddResource("HeaderString3", "Year"); rw.AddResource("HeaderString4", "Doors"); rw.AddResource("HeaderString5", "Cylinders"); - rw.AddResource("Information", SystemIcons.Information); + rw.AddResource("Information", SystemIcons.Information); rw.AddResource("EarlyAuto1", car1); - rw.AddResource("EarlyAuto2", car2); + rw.AddResource("EarlyAuto2", car2); } } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.resx/cs/create1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.resx/cs/create1.cs index c14448f26007d..5501d9b42883e 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.resx/cs/create1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.resx/cs/create1.cs @@ -10,14 +10,14 @@ private int carYear; private int carDoors; private int carCylinders; - - public Automobile(string make, string model, int year) : - this(make, model, year, 0, 0) + + public Automobile(string make, string model, int year) : + this(make, model, year, 0, 0) { } - - public Automobile(string make, string model, int year, + + public Automobile(string make, string model, int year, int doors, int cylinders) - { + { this.carMake = make; this.carModel = model; this.carYear = year; @@ -27,23 +27,23 @@ public Automobile(string make, string model, int year, public string Make { get { return this.carMake; } - } - + } + public string Model { get {return this.carModel; } - } - + } + public int Year { get { return this.carYear; } - } - + } + public int Doors { get { return this.carDoors; } - } - + } + public int Cylinders { get { return this.carCylinders; } - } + } } public class Example @@ -62,9 +62,9 @@ public static void Main() resx.AddResource("HeaderString3", "Year"); resx.AddResource("HeaderString4", "Doors"); resx.AddResource("HeaderString5", "Cylinders"); - resx.AddResource("Information", SystemIcons.Information); - resx.AddResource("EarlyAuto1", car1); - resx.AddResource("EarlyAuto2", car2); + resx.AddResource("Information", SystemIcons.Information); + resx.AddResource("EarlyAuto1", car1); + resx.AddResource("EarlyAuto2", car2); } } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.resx/cs/enumerate1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.resx/cs/enumerate1.cs index f441b7daeaa98..c19d57c823729 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.resx/cs/enumerate1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.resx/cs/enumerate1.cs @@ -11,29 +11,29 @@ public static void Main() string resxFile = @".\CarResources.resx"; List autos = new List(); SortedList headers = new SortedList(); - + using (ResXResourceReader resxReader = new ResXResourceReader(resxFile)) { foreach (DictionaryEntry entry in resxReader) { if (((string) entry.Key).StartsWith("EarlyAuto")) - autos.Add((Automobile) entry.Value); - else if (((string) entry.Key).StartsWith("Header")) - headers.Add((string) entry.Key, (string) entry.Value); - } + autos.Add((Automobile) entry.Value); + else if (((string) entry.Key).StartsWith("Header")) + headers.Add((string) entry.Key, (string) entry.Value); + } } string[] headerColumns = new string[headers.Count]; headers.GetValueList().CopyTo(headerColumns, 0); - Console.WriteLine("{0,-8} {1,-10} {2,-4} {3,-5} {4,-9}\n", + Console.WriteLine("{0,-8} {1,-10} {2,-4} {3,-5} {4,-9}\n", headerColumns); - foreach (var auto in autos) - Console.WriteLine("{0,-8} {1,-10} {2,4} {3,5} {4,9}", - auto.Make, auto.Model, auto.Year, + foreach (var auto in autos) + Console.WriteLine("{0,-8} {1,-10} {2,4} {3,5} {4,9}", + auto.Make, auto.Model, auto.Year, auto.Doors, auto.Cylinders); } } // The example displays the following output: // Make Model Year Doors Cylinders -// +// // Ford Model N 1906 0 4 // Ford Model T 1909 2 4 // @@ -45,14 +45,14 @@ public static void Main() private int carYear; private int carDoors; private int carCylinders; - - public Automobile(string make, string model, int year) : - this(make, model, year, 0, 0) + + public Automobile(string make, string model, int year) : + this(make, model, year, 0, 0) { } - - public Automobile(string make, string model, int year, + + public Automobile(string make, string model, int year, int doors, int cylinders) - { + { this.carMake = make; this.carModel = model; this.carYear = year; @@ -62,21 +62,21 @@ public Automobile(string make, string model, int year, public string Make { get { return this.carMake; } - } - + } + public string Model { get {return this.carModel; } - } - + } + public int Year { get { return this.carYear; } - } - + } + public int Doors { get { return this.carDoors; } - } - + } + public int Cylinders { get { return this.carCylinders; } - } + } } \ No newline at end of file diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.resx/cs/retrieve1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.resx/cs/retrieve1.cs index 637975d7b528a..551026945f1c8 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.resx/cs/retrieve1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.resx/cs/retrieve1.cs @@ -25,7 +25,7 @@ public CarDisplayApp() DataGridView grid = new DataGridView(); grid.Location = new Point(10, 60); this.Controls.Add(grid); - + // Get resources from .resx file. using (ResXResourceSet resxSet = new ResXResourceSet(resxFile)) { @@ -36,15 +36,15 @@ public CarDisplayApp() if (image != null) pictureBox.Image = image.ToBitmap(); - // Retrieve Automobile objects. + // Retrieve Automobile objects. List carList = new List(); string resName = "EarlyAuto"; - Automobile auto; + Automobile auto; int ctr = 1; do { auto = (Automobile) resxSet.GetObject(resName + ctr.ToString()); ctr++; - if (auto != null) + if (auto != null) carList.Add(auto); } while (auto != null); cars = carList.ToArray(); @@ -61,14 +61,14 @@ public CarDisplayApp() private int carYear; private int carDoors; private int carCylinders; - - public Automobile(string make, string model, int year) : - this(make, model, year, 0, 0) + + public Automobile(string make, string model, int year) : + this(make, model, year, 0, 0) { } - - public Automobile(string make, string model, int year, + + public Automobile(string make, string model, int year, int doors, int cylinders) - { + { this.carMake = make; this.carModel = model; this.carYear = year; @@ -78,21 +78,21 @@ public Automobile(string make, string model, int year, public string Make { get { return this.carMake; } - } - + } + public string Model { get {return this.carModel; } - } - + } + public int Year { get { return this.carYear; } - } - + } + public int Doors { get { return this.carDoors; } - } - + } + public int Cylinders { get { return this.carCylinders; } - } + } } \ No newline at end of file diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.retrieving/cs/createresources.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.retrieving/cs/createresources.cs index fed53a3d918b3..98dff8dff3dbc 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.retrieving/cs/createresources.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.retrieving/cs/createresources.cs @@ -12,11 +12,11 @@ public static void Main() Bitmap bmp = new Bitmap(@".\SplashScreen.jpg"); MemoryStream imageStream = new MemoryStream(); bmp.Save(imageStream, ImageFormat.Jpeg); - + ResXResourceWriter writer = new ResXResourceWriter("AppResources.resx"); writer.AddResource("SplashScreen", imageStream); writer.Generate(); - writer.Close(); + writer.Close(); } } // \ No newline at end of file diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.retrieving/cs/ctor1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.retrieving/cs/ctor1.cs index 74fd4bc4d92dd..1dd0a824c4f75 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.retrieving/cs/ctor1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.retrieving/cs/ctor1.cs @@ -12,9 +12,9 @@ public static void Main() static void CallCtor1() { // - ResourceManager rm = new ResourceManager("MyCompany.StringResources", + ResourceManager rm = new ResourceManager("MyCompany.StringResources", typeof(Example).Assembly); - // + // } static void CallCtor2() diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.retrieving/cs/example.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.retrieving/cs/example.cs index 42ba44416911a..1663582493bbf 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.retrieving/cs/example.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.retrieving/cs/example.cs @@ -4,13 +4,13 @@ [Serializable] public struct PersonTable { public readonly int nColumns; - public readonly string column1; + public readonly string column1; public readonly string column2; - public readonly string column3; + public readonly string column3; public readonly int width1; public readonly int width2; public readonly int width3; - + public PersonTable(string column1, string column2, string column3, int width1, int width2, int width3) { @@ -20,7 +20,7 @@ public PersonTable(string column1, string column2, string column3, this.width1 = width1; this.width2 = width2; this.width3 = width3; - this.nColumns = typeof(PersonTable).GetFields().Length / 2; + this.nColumns = typeof(PersonTable).GetFields().Length / 2; } } // diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.retrieving/cs/example1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.retrieving/cs/example1.cs index ba30e0d544312..0ba2c290fabb0 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.retrieving/cs/example1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.retrieving/cs/example1.cs @@ -6,7 +6,7 @@ public class CreateResource { public static void Main() { - PersonTable table = new PersonTable("Name", "Employee Number", + PersonTable table = new PersonTable("Name", "Employee Number", "Age", 30, 18, 5); ResXResourceWriter rr = new ResXResourceWriter(@".\UIResources.resx"); rr.AddResource("TableName", "Employees of Acme Corporation"); @@ -20,13 +20,13 @@ public static void Main() [Serializable] public struct PersonTable { public readonly int nColumns; - public readonly string column1; + public readonly string column1; public readonly string column2; - public readonly string column3; + public readonly string column3; public readonly int width1; public readonly int width2; public readonly int width3; - + public PersonTable(string column1, string column2, string column3, int width1, int width2, int width3) { @@ -36,6 +36,6 @@ public PersonTable(string column1, string column2, string column3, this.width1 = width1; this.width2 = width2; this.width3 = width3; - this.nColumns = typeof(PersonTable).GetFields().Length / 2; + this.nColumns = typeof(PersonTable).GetFields().Length / 2; } } \ No newline at end of file diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.retrieving/cs/example2.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.retrieving/cs/example2.cs index 8bf93ac9b0fce..f87dbd0d6406d 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.retrieving/cs/example2.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.retrieving/cs/example2.cs @@ -9,13 +9,13 @@ public class Example public static void Main() { string fmtString = String.Empty; - ResourceManager rm = new ResourceManager("UIResources", typeof(Example).Assembly); + ResourceManager rm = new ResourceManager("UIResources", typeof(Example).Assembly); string title = rm.GetString("TableName"); PersonTable tableInfo = (PersonTable) rm.GetObject("Employees"); if (! String.IsNullOrEmpty(title)) { - fmtString = "{0," + ((Console.WindowWidth + title.Length) / 2).ToString() + "}"; - Console.WriteLine(fmtString, title); + fmtString = "{0," + ((Console.WindowWidth + title.Length) / 2).ToString() + "}"; + Console.WriteLine(fmtString, title); Console.WriteLine(); } @@ -26,7 +26,7 @@ public static void Main() int width = (int) tableInfo.GetType().GetField(widthName).GetValue(tableInfo); fmtString = "{0,-" + width.ToString() + "}"; Console.Write(fmtString, value); - } + } Console.WriteLine(); } } @@ -35,13 +35,13 @@ public static void Main() [Serializable] public struct PersonTable { public readonly int nColumns; - public readonly string column1; + public readonly string column1; public readonly string column2; - public readonly string column3; + public readonly string column3; public readonly int width1; public readonly int width2; public readonly int width3; - + public PersonTable(string column1, string column2, string column3, int width1, int width2, int width3) { @@ -51,6 +51,6 @@ public PersonTable(string column1, string column2, string column3, this.width1 = width1; this.width2 = width2; this.width3 = width3; - this.nColumns = typeof(PersonTable).GetFields().Length / 2; + this.nColumns = typeof(PersonTable).GetFields().Length / 2; } } \ No newline at end of file diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.retrieving/cs/example3.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.retrieving/cs/example3.cs index 45eb5f7ae6d6a..1828619dcb126 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.retrieving/cs/example3.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.retrieving/cs/example3.cs @@ -12,7 +12,7 @@ public static void Main() { string[] cultureNames = { "en-US", "en-CA", "ru-RU", "fr-FR" }; ResourceManager rm = ResourceManager.CreateFileBasedResourceManager("Strings", "Resources", null); - + foreach (var cultureName in cultureNames) { Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(cultureName); string greeting = rm.GetString("Greeting", CultureInfo.CurrentCulture); @@ -29,16 +29,16 @@ public static void Main() // Hello! // What is your name? Dakota // Hello, Dakota! -// +// // Hello! // What is your name? Koani // Hello, Koani! -// +// // Здравствуйте! // Как вас зовут?Samuel // Здравствуйте, Samuel! -// +// // Bon jour! // Comment vous appelez-vous?Yiska // Bon jour, Yiska! -// \ No newline at end of file +// \ No newline at end of file diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.retrieving/cs/getstream.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.retrieving/cs/getstream.cs index afb4fb99fd146..49184c095031f 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.retrieving/cs/getstream.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.retrieving/cs/getstream.cs @@ -11,13 +11,13 @@ public static void Main() { ResourceManager rm = new ResourceManager("AppResources", typeof(Example).Assembly); Bitmap screen = (Bitmap) Image.FromStream(rm.GetStream("SplashScreen")); - + Form frm = new Form(); frm.Size = new Size(300, 300); PictureBox pic = new PictureBox(); pic.Bounds = frm.RestoreBounds; - pic.BorderStyle = BorderStyle.Fixed3D; + pic.BorderStyle = BorderStyle.Fixed3D; pic.Image = screen; pic.SizeMode = PictureBoxSizeMode.StretchImage; diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.retrieving/cs/getstring.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.retrieving/cs/getstring.cs index f166dc2fba76a..cc900bf8b94b8 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.retrieving/cs/getstring.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.retrieving/cs/getstring.cs @@ -12,7 +12,7 @@ public static void Main() { string[] cultureNames = { "en-US", "fr-FR", "ru-RU", "es-ES" }; Random rnd = new Random(); - ResourceManager rm = new ResourceManager("Strings", + ResourceManager rm = new ResourceManager("Strings", typeof(Example).Assembly); for (int ctr = 0; ctr <= cultureNames.Length; ctr++) { @@ -20,26 +20,26 @@ public static void Main() CultureInfo culture = CultureInfo.CreateSpecificCulture(cultureName); Thread.CurrentThread.CurrentCulture = culture; Thread.CurrentThread.CurrentUICulture = culture; - + Console.WriteLine("Current culture: {0}", culture.NativeName); string timeString = rm.GetString("TimeHeader"); - Console.WriteLine("{0} {1:T}\n", timeString, DateTime.Now); - } + Console.WriteLine("{0} {1:T}\n", timeString, DateTime.Now); + } } } // The example displays output like the following: // Current culture: English (United States) // The current time is 9:34:18 AM -// +// // Current culture: Español (España, alfabetización internacional) // The current time is 9:34:18 -// +// // Current culture: русский (Россия) // Текущее время — 9:34:18 -// +// // Current culture: français (France) // L'heure actuelle est 09:34:18 -// +// // Current culture: русский (Россия) // Текущее время — 9:34:18 // diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.satellites/cs/example.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.satellites/cs/example.cs index 472ce799d4685..7e2104ef31211 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.satellites/cs/example.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.satellites/cs/example.cs @@ -12,9 +12,9 @@ public static void Main() { string[] cultureNames = { "en-GB", "en-US", "fr-FR", "ru-RU" }; Random rnd = new Random(); - string cultureName = cultureNames[rnd.Next(0, cultureNames.Length)]; + string cultureName = cultureNames[rnd.Next(0, cultureNames.Length)]; Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture(cultureName); - Console.WriteLine("The current UI culture is {0}", + Console.WriteLine("The current UI culture is {0}", Thread.CurrentThread.CurrentUICulture.Name); StringLibrary strLib = new StringLibrary(); string greeting = strLib.GetGreeting(); @@ -27,7 +27,7 @@ public class StringLibrary { public string GetGreeting() { - ResourceManager rm = new ResourceManager("Strings", + ResourceManager rm = new ResourceManager("Strings", Assembly.GetAssembly(typeof(StringLibrary))); string greeting = rm.GetString("Greeting"); return greeting; diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.satellites/cs/stringlibrary.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.satellites/cs/stringlibrary.cs index 875108345b714..12955d1656aac 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.satellites/cs/stringlibrary.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.satellites/cs/stringlibrary.cs @@ -13,7 +13,7 @@ public class StringLibrary { public string GetGreeting() { - ResourceManager rm = new ResourceManager("Strings", + ResourceManager rm = new ResourceManager("Strings", Assembly.GetAssembly(typeof(StringLibrary))); string greeting = rm.GetString("Greeting"); return greeting; diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.textfiles/cs/greeting.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.textfiles/cs/greeting.cs index b8633a1a2a865..5d5d75b188141 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.textfiles/cs/greeting.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.textfiles/cs/greeting.cs @@ -7,11 +7,11 @@ public class Example { public static void Main() { - ResourceManager rm = new ResourceManager("GreetingResources", + ResourceManager rm = new ResourceManager("GreetingResources", typeof(Example).Assembly); Console.Write(rm.GetString("prompt")); string name = Console.ReadLine(); - Console.WriteLine(rm.GetString("greeting"), name); + Console.WriteLine(rm.GetString("greeting"), name); } } // The example displays output like the following: diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.string.basicops/cs/basicops.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.string.basicops/cs/basicops.cs index bb105d06d1601..f26b5fec358e5 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.string.basicops/cs/basicops.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.string.basicops/cs/basicops.cs @@ -1,6 +1,6 @@ // using System; - + class MainClass { static void Main() @@ -14,14 +14,14 @@ static void Main() Console.Write("Enter Your City, State, and ZIP Code separated by spaces: "); MyData.CityStateZip = Console.ReadLine(); Console.WriteLine(); - + if (MyData.Validated) { Console.WriteLine("Name: {0}", MyData.Name); Console.WriteLine("Address: {0}", MyData.Address); Console.WriteLine("City: {0}", MyData.City); Console.WriteLine("State: {0}", MyData.State); Console.WriteLine("Zip: {0}", MyData.Zip); - + Console.WriteLine("\nThe following address will be used:"); Console.WriteLine(MyData.Address); Console.WriteLine(MyData.CityStateZip); @@ -32,13 +32,13 @@ static void Main() public class MailToData { string name = ""; - string address = ""; + string address = ""; string citystatezip = ""; - string city = ""; - string state = ""; + string city = ""; + string state = ""; string zip = ""; bool parseSucceeded = false; - + public string Name { get{return name;} @@ -53,8 +53,8 @@ public string Address public string CityStateZip { - get { - return String.Format("{0}, {1} {2}", city, state, zip); + get { + return String.Format("{0}, {1} {2}", city, state, zip); } set { citystatezip = value.Trim(); @@ -86,29 +86,29 @@ public bool Validated } private void ParseCityStateZip() - { + { string msg = ""; const string msgEnd = "\nYou must enter spaces between city, state, and zip code.\n"; // Throw a FormatException if the user did not enter the necessary spaces - // between elements. + // between elements. try { - // City may consist of multiple words, so we'll have to parse the + // City may consist of multiple words, so we'll have to parse the // string from right to left starting with the zip code. int zipIndex = citystatezip.LastIndexOf(" "); - if (zipIndex == -1) { + if (zipIndex == -1) { msg = "\nCannot identify a zip code." + msgEnd; throw new FormatException(msg); } - zip = citystatezip.Substring(zipIndex + 1); + zip = citystatezip.Substring(zipIndex + 1); int stateIndex = citystatezip.LastIndexOf(" ", zipIndex - 1); - if (stateIndex == -1) { + if (stateIndex == -1) { msg = "\nCannot identify a state." + msgEnd; throw new FormatException(msg); } - state = citystatezip.Substring(stateIndex + 1, zipIndex - stateIndex - 1); + state = citystatezip.Substring(stateIndex + 1, zipIndex - stateIndex - 1); state = state.ToUpper(); city = citystatezip.Substring(0, stateIndex); @@ -121,7 +121,7 @@ private void ParseCityStateZip() catch (FormatException ex) { Console.WriteLine(ex.Message); - } + } } private string ReturnCityStateZip() @@ -131,7 +131,7 @@ private string ReturnCityStateZip() // Put the value of city, state, and zip together in the proper manner. string MyCityStateZip = String.Concat(city, ", ", state, " ", zip); - + return MyCityStateZip; } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.string.basicops/cs/compare.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.string.basicops/cs/compare.cs index b6510d2e5aaf1..e16b2089edda8 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.string.basicops/cs/compare.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.string.basicops/cs/compare.cs @@ -9,7 +9,7 @@ public static void Main() CompareOrdinal(); Console.Write("CompareTo: "); CompareTo(); - Console.Write("Equals: "); + Console.Write("Equals: "); Equals1(); Equals2(); StartsWith(); @@ -17,7 +17,7 @@ public static void Main() IndexOf(); LastIndexOf(); } - + public static void Compare() { // diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.string.basicops/cs/trimming.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.string.basicops/cs/trimming.cs index a71f23926188e..676473ae192b1 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.string.basicops/cs/trimming.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.string.basicops/cs/trimming.cs @@ -61,7 +61,7 @@ public static void Remove() string MyString = "Hello Beautiful World!"; Console.WriteLine(MyString.Remove(5,10)); // The example displays the following output: - // Hello World! + // Hello World! // } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.strings.bestpractices/cs/api1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.strings.bestpractices/cs/api1.cs index 7c4c6dcb85331..fd039fa965b50 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.strings.bestpractices/cs/api1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.strings.bestpractices/cs/api1.cs @@ -4,15 +4,15 @@ public class FileName : IComparable { string fname; - StringComparer comparer; - + StringComparer comparer; + public FileName(string name, StringComparer comparer) { if (String.IsNullOrEmpty(name)) throw new ArgumentNullException("name"); this.fname = name; - + if (comparer != null) this.comparer = comparer; else @@ -23,7 +23,7 @@ public string Name { get { return fname; } } - + public int CompareTo(object obj) { if (obj == null) return 1; diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.strings.bestpractices/cs/comparison1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.strings.bestpractices/cs/comparison1.cs index c45d39d650b02..2707495225354 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.strings.bestpractices/cs/comparison1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.strings.bestpractices/cs/comparison1.cs @@ -7,7 +7,7 @@ public class Example { public static void Main() { - string[] values= { "able", "ångström", "apple", "Æble", + string[] values= { "able", "ångström", "apple", "Æble", "Windows", "Visual Studio" }; Array.Sort(values); DisplayArray(values); @@ -21,10 +21,10 @@ public static void Main() // Restore the original culture. Thread.CurrentThread.CurrentCulture = new CultureInfo(originalCulture); } - + private static void DisplayArray(string[] values) { - Console.WriteLine("Sorting using the {0} culture:", + Console.WriteLine("Sorting using the {0} culture:", CultureInfo.CurrentCulture.Name); foreach (string value in values) Console.WriteLine(" {0}", value); @@ -40,7 +40,7 @@ private static void DisplayArray(string[] values) // apple // Visual Studio // Windows -// +// // Sorting using the sv-SE culture: // able // Æble diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.strings.bestpractices/cs/comparison2.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.strings.bestpractices/cs/comparison2.cs index 685de24f46034..ecc43bb3acdba 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.strings.bestpractices/cs/comparison2.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.strings.bestpractices/cs/comparison2.cs @@ -5,17 +5,17 @@ public static void Main() { string strA = "Владимир"; string strB = "ВЛАДИМИР"; - + // String.Compare(strA, strB, StringComparison.OrdinalIgnoreCase); - // + // Console.WriteLine(String.Compare(strA, strB, StringComparison.OrdinalIgnoreCase)); // - String.Compare(strA.ToUpperInvariant(), strB.ToUpperInvariant(), + String.Compare(strA.ToUpperInvariant(), strB.ToUpperInvariant(), StringComparison.Ordinal); // - Console.WriteLine(String.Compare(strA.ToUpperInvariant(), strB.ToUpperInvariant(), + Console.WriteLine(String.Compare(strA.ToUpperInvariant(), strB.ToUpperInvariant(), StringComparison.Ordinal)); } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.strings.bestpractices/cs/comparison3.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.strings.bestpractices/cs/comparison3.cs index cd5ed21e4617d..6186d33f0ba1e 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.strings.bestpractices/cs/comparison3.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.strings.bestpractices/cs/comparison3.cs @@ -7,19 +7,19 @@ public static void Main() // string separated = "\u0061\u030a"; string combined = "\u00e5"; - + Console.WriteLine("Equal sort weight of {0} and {1} using InvariantCulture: {2}", - separated, combined, - String.Compare(separated, combined, + separated, combined, + String.Compare(separated, combined, StringComparison.InvariantCulture) == 0); - + Console.WriteLine("Equal sort weight of {0} and {1} using Ordinal: {2}", separated, combined, - String.Compare(separated, combined, + String.Compare(separated, combined, StringComparison.Ordinal) == 0); // The example displays the following output: // Equal sort weight of a° and å using InvariantCulture: True - // Equal sort weight of a° and å using Ordinal: False + // Equal sort weight of a° and å using Ordinal: False // } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.strings.bestpractices/cs/embeddednulls1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.strings.bestpractices/cs/embeddednulls1.cs index 387511fa9c4dc..938ab7b987447 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.strings.bestpractices/cs/embeddednulls1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.strings.bestpractices/cs/embeddednulls1.cs @@ -7,21 +7,21 @@ public static void Main() { string str1 = "Aa"; string str2 = "A" + new String('\u0000', 3) + "a"; - Console.WriteLine("Comparing '{0}' ({1}) and '{2}' ({3}):", + Console.WriteLine("Comparing '{0}' ({1}) and '{2}' ({3}):", str1, ShowBytes(str1), str2, ShowBytes(str2)); Console.WriteLine(" With String.Compare:"); - Console.WriteLine(" Current Culture: {0}", + Console.WriteLine(" Current Culture: {0}", String.Compare(str1, str2, StringComparison.CurrentCulture)); - Console.WriteLine(" Invariant Culture: {0}", + Console.WriteLine(" Invariant Culture: {0}", String.Compare(str1, str2, StringComparison.InvariantCulture)); Console.WriteLine(" With String.Equals:"); - Console.WriteLine(" Current Culture: {0}", + Console.WriteLine(" Current Culture: {0}", String.Equals(str1, str2, StringComparison.CurrentCulture)); - Console.WriteLine(" Invariant Culture: {0}", + Console.WriteLine(" Invariant Culture: {0}", String.Equals(str1, str2, StringComparison.InvariantCulture)); } - + private static string ShowBytes(string str) { string hexString = String.Empty; diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.strings.bestpractices/cs/embeddednulls2.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.strings.bestpractices/cs/embeddednulls2.cs index 3d83d395f987c..d57d2059b8ab6 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.strings.bestpractices/cs/embeddednulls2.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.strings.bestpractices/cs/embeddednulls2.cs @@ -7,14 +7,14 @@ public static void Main() string str1 = "Aa"; string str2 = "A" + new String('\u0000', 3) + "a"; // - Console.WriteLine("Comparing '{0}' ({1}) and '{2}' ({3}):", + Console.WriteLine("Comparing '{0}' ({1}) and '{2}' ({3}):", str1, ShowBytes(str1), str2, ShowBytes(str2)); Console.WriteLine(" With String.Compare:"); - Console.WriteLine(" Ordinal: {0}", + Console.WriteLine(" Ordinal: {0}", String.Compare(str1, str2, StringComparison.Ordinal)); Console.WriteLine(" With String.Equals:"); - Console.WriteLine(" Ordinal: {0}", + Console.WriteLine(" Ordinal: {0}", String.Equals(str1, str2, StringComparison.Ordinal)); // The example displays the following output: // Comparing 'Aa' (00 41 00 61) and 'A a' (00 41 00 00 00 00 00 00 00 61): @@ -24,7 +24,7 @@ public static void Main() // Ordinal: False // } - + private static string ShowBytes(string str) { string hexString = String.Empty; diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.strings.bestpractices/cs/explicitargs1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.strings.bestpractices/cs/explicitargs1.cs index 2ef1be743d5fd..db7238e29228e 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.strings.bestpractices/cs/explicitargs1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.strings.bestpractices/cs/explicitargs1.cs @@ -7,12 +7,12 @@ public static void Main() CompareWithDefaults(); CompareExplicit(); } - + private static void CompareWithDefaults() { Uri url = new Uri("http://msdn.microsoft.com"); - // - string protocol = GetProtocol(url); + // + string protocol = GetProtocol(url); if (String.Equals(protocol, "http")) { // ...Code to handle HTTP protocol. } @@ -25,8 +25,8 @@ private static void CompareWithDefaults() private static void CompareExplicit() { Uri url = new Uri("http://msdn.microsoft.com"); - // - string protocol = GetProtocol(url); + // + string protocol = GetProtocol(url); if (String.Equals(protocol, "http", StringComparison.OrdinalIgnoreCase)) { // ...Code to handle HTTP protocol. } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.strings.bestpractices/cs/indirect1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.strings.bestpractices/cs/indirect1.cs index 753c17a8ab5a7..c91fc31ae22a6 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.strings.bestpractices/cs/indirect1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.strings.bestpractices/cs/indirect1.cs @@ -9,20 +9,20 @@ public static void Main() // // Incorrect. string []storedNames; - + public void StoreNames(string [] names) { int index = 0; storedNames = new string[names.Length]; - + foreach (string name in names) { this.storedNames[index++] = name; } - + Array.Sort(names); // Line A. } - + public bool DoesNameExist(string name) { return (Array.BinarySearch(this.storedNames, name) >= 0); // Line B. @@ -35,20 +35,20 @@ public class Class8 // // Correct. string []storedNames; - + public void StoreNames(string [] names) { int index = 0; storedNames = new string[names.Length]; - + foreach (string name in names) { this.storedNames[index++] = name; } - + Array.Sort(names, StringComparer.Ordinal); // Line A. } - + public bool DoesNameExist(string name) { return (Array.BinarySearch(this.storedNames, name, StringComparer.Ordinal) >= 0); // Line B. @@ -61,20 +61,20 @@ public class Class9 // // Correct. string []storedNames; - + public void StoreNames(string [] names) { int index = 0; storedNames = new string[names.Length]; - + foreach (string name in names) { this.storedNames[index++] = name; } - + Array.Sort(names, StringComparer.InvariantCulture); // Line A. } - + public bool DoesNameExist(string name) { return (Array.BinarySearch(this.storedNames, name, StringComparer.InvariantCulture) >= 0); // Line B. diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.strings.bestpractices/cs/indirect2.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.strings.bestpractices/cs/indirect2.cs index 2a9b9e558520a..b2fb054aec2c9 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.strings.bestpractices/cs/indirect2.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.strings.bestpractices/cs/indirect2.cs @@ -7,23 +7,23 @@ public class Test // const int initialTableCapacity = 100; Hashtable h; - + public void PopulateFileTable(string directory) { - h = new Hashtable(initialTableCapacity, + h = new Hashtable(initialTableCapacity, StringComparer.OrdinalIgnoreCase); - + foreach (string file in Directory.GetFiles(directory)) h.Add(file, File.GetCreationTime(file)); } - + public void PrintCreationTime(string targetFile) { Object dt = h[targetFile]; if (dt != null) { Console.WriteLine("File {0} was created at time {1}.", - targetFile, + targetFile, (DateTime) dt); } else diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.strings.bestpractices/cs/persistence.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.strings.bestpractices/cs/persistence.cs index bb3c240d28e75..b46a4fb66410f 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.strings.bestpractices/cs/persistence.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.strings.bestpractices/cs/persistence.cs @@ -11,11 +11,11 @@ public class Example public static void Main() { - DateTime[] dates = { new DateTime(1758, 5, 6, 21, 26, 0), - new DateTime(1818, 5, 5, 7, 19, 0), - new DateTime(1870, 4, 22, 23, 54, 0), - new DateTime(1890, 9, 8, 6, 47, 0), - new DateTime(1905, 2, 18, 15, 12, 0) }; + DateTime[] dates = { new DateTime(1758, 5, 6, 21, 26, 0), + new DateTime(1818, 5, 5, 7, 19, 0), + new DateTime(1870, 4, 22, 23, 54, 0), + new DateTime(1890, 9, 8, 6, 47, 0), + new DateTime(1905, 2, 18, 15, 12, 0) }; // Write the data to a file using the current culture. WriteData(dates); // Change the current culture. @@ -25,28 +25,28 @@ public static void Main() foreach (var newDate in newDates) Console.WriteLine(newDate.ToString("g")); } - - private static void WriteData(DateTime[] dates) + + private static void WriteData(DateTime[] dates) { - StreamWriter sw = new StreamWriter(filename, false, Encoding.UTF8); + StreamWriter sw = new StreamWriter(filename, false, Encoding.UTF8); for (int ctr = 0; ctr < dates.Length; ctr++) { sw.Write("{0}", dates[ctr].ToString("g", CultureInfo.CurrentCulture)); - if (ctr < dates.Length - 1) sw.Write("|"); - } + if (ctr < dates.Length - 1) sw.Write("|"); + } sw.Close(); } - - private static DateTime[] ReadData() + + private static DateTime[] ReadData() { bool exceptionOccurred = false; - + // Read file contents as a single string, then split it. StreamReader sr = new StreamReader(filename, Encoding.UTF8); string output = sr.ReadToEnd(); - sr.Close(); + sr.Close(); string[] values = output.Split( new char[] { '|' } ); - DateTime[] newDates = new DateTime[values.Length]; + DateTime[] newDates = new DateTime[values.Length]; for (int ctr = 0; ctr < values.Length; ctr++) { try { newDates[ctr] = DateTime.Parse(values[ctr], CultureInfo.CurrentCulture); @@ -55,7 +55,7 @@ private static DateTime[] ReadData() Console.WriteLine("Failed to parse {0}", values[ctr]); exceptionOccurred = true; } - } + } if (exceptionOccurred) Console.WriteLine(); return newDates; } @@ -63,7 +63,7 @@ private static DateTime[] ReadData() // The example displays the following output: // Failed to parse 4/22/1870 11:54 PM // Failed to parse 2/18/1905 3:12 PM -// +// // 05.06.1758 21:26 // 05.05.1818 07:19 // 01.01.0001 00:00 diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.strings.bestpractices/cs/settings1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.strings.bestpractices/cs/settings1.cs index b2f2f02547c27..d2bf18b7d2128 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.strings.bestpractices/cs/settings1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.strings.bestpractices/cs/settings1.cs @@ -13,11 +13,11 @@ private static void SetRegistryKey() // Open the NETFramework key Microsoft.Win32.RegistryKey nf = lm.CreateSubKey(@"Software\Microsoft\.NETFramework"); // Set the value to 1. This overwrites any existing setting. - nf.SetValue("String_LegacyCompareMode", 1, + nf.SetValue("String_LegacyCompareMode", 1, Microsoft.Win32.RegistryValueKind.DWord); // } - + // private static bool IsStringLegacyCompareMode() { @@ -25,7 +25,7 @@ private static bool IsStringLegacyCompareMode() // Open the NETFramework key Microsoft.Win32.RegistryKey nf = lm.OpenSubKey(@"Software\Microsoft\.NETFramework"); if (nf == null) return false; - + // Get the String_LegacyCompareMode setting. return (bool) nf.GetValue("String_LegacyCompareMode", 0); } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.strings.bestpractices/cs/turkish1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.strings.bestpractices/cs/turkish1.cs index a2ac00448e26c..bc162328a2855 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.strings.bestpractices/cs/turkish1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.strings.bestpractices/cs/turkish1.cs @@ -11,29 +11,29 @@ public static void Main() Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US"); Console.WriteLine("Culture = {0}", Thread.CurrentThread.CurrentCulture.DisplayName); - Console.WriteLine("(file == FILE) = {0}", + Console.WriteLine("(file == FILE) = {0}", fileUrl.StartsWith("FILE", true, null)); Console.WriteLine(); - + Thread.CurrentThread.CurrentCulture = new CultureInfo("tr-TR"); Console.WriteLine("Culture = {0}", Thread.CurrentThread.CurrentCulture.DisplayName); - Console.WriteLine("(file == FILE) = {0}", + Console.WriteLine("(file == FILE) = {0}", fileUrl.StartsWith("FILE", true, null)); } } // The example displays the following output: // Culture = English (United States) // (file == FILE) = True -// +// // Culture = Turkish (Turkey) // (file == FILE) = False // public class Example2 { - // - public static bool IsFileURI(String path) + // + public static bool IsFileURI(String path) { return path.StartsWith("FILE:", true, null); } @@ -43,7 +43,7 @@ public static bool IsFileURI(String path) public class Example3 { // - public static bool IsFileURI(string path) + public static bool IsFileURI(string path) { return path.StartsWith("FILE:", StringComparison.OrdinalIgnoreCase); } @@ -56,9 +56,9 @@ public class Example4 public static bool IsFileURI(string path) { if (path.Length < 5) return false; - - return String.Equals(path.Substring(0, 5), "FILE:", + + return String.Equals(path.Substring(0, 5), "FILE:", StringComparison.OrdinalIgnoreCase); - } + } // } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.strings.cultureinsensitivecomparison/cs/cultureinsensitive1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.strings.cultureinsensitivecomparison/cs/cultureinsensitive1.cs index af0881bbfa370..c1e6bfa1b8c96 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.strings.cultureinsensitivecomparison/cs/cultureinsensitive1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.strings.cultureinsensitivecomparison/cs/cultureinsensitive1.cs @@ -8,18 +8,18 @@ public static void Main() string string1 = "file"; string string2 = "FILE"; int compareResult = 0; - - compareResult = String.Compare(string1, string2, + + compareResult = String.Compare(string1, string2, StringComparison.Ordinal); - Console.WriteLine("{0} comparison of '{1}' and '{2}': {3}", - StringComparison.Ordinal, string1, string2, - compareResult); + Console.WriteLine("{0} comparison of '{1}' and '{2}': {3}", + StringComparison.Ordinal, string1, string2, + compareResult); - compareResult = String.Compare(string1, string2, + compareResult = String.Compare(string1, string2, StringComparison.OrdinalIgnoreCase); - Console.WriteLine("{0} comparison of '{1}' and '{2}': {3}", - StringComparison.OrdinalIgnoreCase, string1, string2, - compareResult); + Console.WriteLine("{0} comparison of '{1}' and '{2}': {3}", + StringComparison.OrdinalIgnoreCase, string1, string2, + compareResult); } } // The example displays the following output: diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.tap/cs/examples1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.tap/cs/examples1.cs index 10ef43e25d371..c600b13ea22ff 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.tap/cs/examples1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.tap/cs/examples1.cs @@ -12,39 +12,39 @@ public static void Main() } // - public Task ReadAsync(byte [] buffer, int offset, int count, + public Task ReadAsync(byte [] buffer, int offset, int count, CancellationToken cancellationToken) // { return Task.Factory.StartNew( () => Thread.Sleep(100)); - } + } // - public Task ReadAsync(byte[] buffer, int offset, int count, + public Task ReadAsync(byte[] buffer, int offset, int count, IProgress progress) // { return Task.Factory.StartNew( () => Thread.Sleep(100)); - } + } // public Task> FindFilesAsync( - string pattern, - IProgress>>> progress) // { - return Task.Factory.StartNew( () => { FileInfo[] fi = new FileInfo[10]; + return Task.Factory.StartNew( () => { FileInfo[] fi = new FileInfo[10]; return new ReadOnlyCollection(fi); } ); - } + } // public Task> FindFilesAsync( - string pattern, + string pattern, IProgress progress) // { - return Task.Factory.StartNew( () => { FileInfo[] fi = new FileInfo[10]; + return Task.Factory.StartNew( () => { FileInfo[] fi = new FileInfo[10]; return new ReadOnlyCollection(fi); } ); } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.tap_patterns/cs/patterns1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.tap_patterns/cs/patterns1.cs index 4238584c3a836..52ca549350ebf 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.tap_patterns/cs/patterns1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.tap_patterns/cs/patterns1.cs @@ -25,13 +25,13 @@ public static Task Delay(int millisecondsTimeout) { TaskCompletionSource tcs = null; Timer timer = null; - + timer = new Timer(delegate { timer.Dispose(); tcs.TrySetResult(DateTimeOffset.UtcNow); }, null, Timeout.Infinite, Timeout.Infinite); - + tcs = new TaskCompletionSource(timer); timer.Change(millisecondsTimeout, Timeout.Infinite); return tcs.Task; @@ -39,7 +39,7 @@ public static Task Delay(int millisecondsTimeout) // // - public static async Task Poll(Uri url, CancellationToken cancellationToken, + public static async Task Poll(Uri url, CancellationToken cancellationToken, IProgress progress) { while(true) @@ -56,11 +56,11 @@ public static async Task Poll(Uri url, CancellationToken cancellationToken, } } // - - static Task DownloadStringAsync(Uri url) - { + + static Task DownloadStringAsync(Uri url) + { var tcs = new TaskCompletionSource(); - return tcs.Task; + return tcs.Task; } } @@ -74,7 +74,7 @@ public Task MethodAsync(string input) if (input == null) throw new ArgumentNullException("input"); return MethodAsyncInternal(input); } - + private async Task MethodAsyncInternal(string input) { @@ -83,7 +83,7 @@ private async Task MethodAsyncInternal(string input) return value; } // - + // internal Task RenderAsync( ImageData data, CancellationToken cancellationToken) @@ -102,26 +102,26 @@ internal Task RenderAsync( return bmp; }, cancellationToken); } - // - + // + // public static Task Delay(int millisecondsTimeout) { TaskCompletionSource tcs = null; Timer timer = null; - + timer = new Timer(delegate { timer.Dispose(); tcs.TrySetResult(true); }, null, Timeout.Infinite, Timeout.Infinite); - + tcs = new TaskCompletionSource(timer); timer.Change(millisecondsTimeout, Timeout.Infinite); return tcs.Task; } - // - + // + // public async Task DownloadDataAndRenderImageAsync( CancellationToken cancellationToken) @@ -130,7 +130,7 @@ public async Task DownloadDataAndRenderImageAsync( return await RenderAsync(imageData, cancellationToken); } // - + private async Task DownloadImageDataAsync(CancellationToken c) { // return new TaskCompletionSource().Task; diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.timespan.custom/cs/customexamples1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.timespan.custom/cs/customexamples1.cs index 0449ca51da320..f8f17c0f1fd39 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.timespan.custom/cs/customexamples1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.timespan.custom/cs/customexamples1.cs @@ -39,19 +39,19 @@ private static void dSpecifier() // TimeSpan ts1 = new TimeSpan(16, 4, 3, 17, 250); Console.WriteLine(ts1.ToString("%d")); - // Displays 16 + // Displays 16 // Console.WriteLine(); - + // TimeSpan ts2 = new TimeSpan(4, 3, 17); Console.WriteLine(ts2.ToString(@"d\.hh\:mm\:ss")); - + TimeSpan ts3 = new TimeSpan(3, 4, 3, 17); Console.WriteLine(ts3.ToString(@"d\.hh\:mm\:ss")); // The example displays the following output: // 0.04:03:17 - // 3.04:03:17 + // 3.04:03:17 // } @@ -60,38 +60,38 @@ private static void ddSpecifier() // TimeSpan ts1 = new TimeSpan(0, 23, 17, 47); TimeSpan ts2 = new TimeSpan(365, 21, 19, 45); - + for (int ctr = 2; ctr <= 8; ctr++) { string fmt = new String('d', ctr) + @"\.hh\:mm\:ss"; - Console.WriteLine("{0} --> {1:" + fmt + "}", fmt, ts1); + Console.WriteLine("{0} --> {1:" + fmt + "}", fmt, ts1); Console.WriteLine("{0} --> {1:" + fmt + "}", fmt, ts2); Console.WriteLine(); - } + } // The example displays the following output: // dd\.hh\:mm\:ss --> 00.23:17:47 // dd\.hh\:mm\:ss --> 365.21:19:45 - // + // // ddd\.hh\:mm\:ss --> 000.23:17:47 // ddd\.hh\:mm\:ss --> 365.21:19:45 - // + // // dddd\.hh\:mm\:ss --> 0000.23:17:47 // dddd\.hh\:mm\:ss --> 0365.21:19:45 - // + // // ddddd\.hh\:mm\:ss --> 00000.23:17:47 // ddddd\.hh\:mm\:ss --> 00365.21:19:45 - // + // // dddddd\.hh\:mm\:ss --> 000000.23:17:47 // dddddd\.hh\:mm\:ss --> 000365.21:19:45 - // + // // ddddddd\.hh\:mm\:ss --> 0000000.23:17:47 // ddddddd\.hh\:mm\:ss --> 0000365.21:19:45 - // + // // dddddddd\.hh\:mm\:ss --> 00000000.23:17:47 - // dddddddd\.hh\:mm\:ss --> 00000365.21:19:45 + // dddddddd\.hh\:mm\:ss --> 00000365.21:19:45 // - } - + } + private static void hSpecifier() { // @@ -100,11 +100,11 @@ private static void hSpecifier() // The example displays the following output: // 3 hours 42 minutes // - + // TimeSpan ts1 = new TimeSpan(14, 3, 17); Console.WriteLine(ts1.ToString(@"d\.h\:mm\:ss")); - + TimeSpan ts2 = new TimeSpan(3, 4, 3, 17); Console.WriteLine(ts2.ToString(@"d\.h\:mm\:ss")); // The example displays the following output: @@ -121,13 +121,13 @@ private static void ParseH() if (TimeSpan.TryParseExact(value, "%h", null, out interval)) Console.WriteLine(interval.ToString("c")); else - Console.WriteLine("Unable to convert '{0}' to a time interval", - value); + Console.WriteLine("Unable to convert '{0}' to a time interval", + value); // The example displays the following output: - // 08:00:00 + // 08:00:00 // - } - + } + private static void ParseHH() { // @@ -136,19 +136,19 @@ private static void ParseHH() if (TimeSpan.TryParseExact(value, "hh", null, out interval)) Console.WriteLine(interval.ToString("c")); else - Console.WriteLine("Unable to convert '{0}' to a time interval", - value); + Console.WriteLine("Unable to convert '{0}' to a time interval", + value); // The example displays the following output: - // 08:00:00 + // 08:00:00 // - } - + } + private static void hhSpecifier() { // TimeSpan ts1 = new TimeSpan(14, 3, 17); Console.WriteLine(ts1.ToString(@"d\.hh\:mm\:ss")); - + TimeSpan ts2 = new TimeSpan(3, 4, 3, 17); Console.WriteLine(ts2.ToString(@"d\.hh\:mm\:ss")); // The example displays the following output: @@ -165,19 +165,19 @@ private static void ParseM() if (TimeSpan.TryParseExact(value, "%m", null, out interval)) Console.WriteLine(interval.ToString("c")); else - Console.WriteLine("Unable to convert '{0}' to a time interval", - value); + Console.WriteLine("Unable to convert '{0}' to a time interval", + value); // The example displays the following output: - // 00:03:00 + // 00:03:00 // - } - + } + private static void mSpecifier() { // TimeSpan ts1 = new TimeSpan(0, 6, 32); Console.WriteLine("{0:m\\:ss} minutes", ts1); - + TimeSpan ts2 = new TimeSpan(3, 4, 3, 17); Console.WriteLine("Elapsed time: {0:m\\:ss}", ts2); // The example displays the following output: @@ -194,27 +194,27 @@ private static void ParseMM() if (TimeSpan.TryParseExact(value, "mm", null, out interval)) Console.WriteLine(interval.ToString("c")); else - Console.WriteLine("Unable to convert '{0}' to a time interval", - value); + Console.WriteLine("Unable to convert '{0}' to a time interval", + value); // The example displays the following output: - // 00:07:00 + // 00:07:00 // - } - + } + private static void mmSpecifier() { // TimeSpan departTime = new TimeSpan(11, 12, 00); TimeSpan arriveTime = new TimeSpan(16, 28, 00); - Console.WriteLine("Travel time: {0:hh\\:mm}", + Console.WriteLine("Travel time: {0:hh\\:mm}", arriveTime - departTime); // The example displays the following output: - // Travel time: 05:16 + // Travel time: 05:16 // - } - + } + private static void sSpecifier() - { + { // TimeSpan ts = TimeSpan.FromSeconds(12.465); Console.WriteLine(ts.ToString("%s")); @@ -226,13 +226,13 @@ private static void sSpecifier() // TimeSpan startTime = new TimeSpan(0, 12, 30, 15, 0); TimeSpan endTime = new TimeSpan(0, 12, 30, 21, 3); - Console.WriteLine(@"Elapsed Time: {0:s\:fff} seconds", + Console.WriteLine(@"Elapsed Time: {0:s\:fff} seconds", endTime - startTime); // The example displays the following output: - // Elapsed Time: 6:003 seconds + // Elapsed Time: 6:003 seconds // - } - + } + private static void ParseS() { // @@ -241,13 +241,13 @@ private static void ParseS() if (TimeSpan.TryParseExact(value, "%s", null, out interval)) Console.WriteLine(interval.ToString("c")); else - Console.WriteLine("Unable to convert '{0}' to a time interval", - value); + Console.WriteLine("Unable to convert '{0}' to a time interval", + value); // The example displays the following output: // 00:00:09 // - } - + } + private static void ParseSS() { // @@ -258,22 +258,22 @@ private static void ParseSS() if (TimeSpan.TryParseExact(value, "ss", null, out interval)) Console.WriteLine(interval.ToString("c")); else - Console.WriteLine("Unable to convert '{0}' to a time interval", - value); + Console.WriteLine("Unable to convert '{0}' to a time interval", + value); } // The example displays the following output: // 00:00:49 // Unable to convert '9' to a time interval // 00:00:06 // - } + } private static void ssSpecifier() { // TimeSpan interval1 = TimeSpan.FromSeconds(12.60); Console.WriteLine(interval1.ToString(@"ss\.fff")); - + TimeSpan interval2 = TimeSpan.FromSeconds(6.485); Console.WriteLine(interval2.ToString(@"ss\.fff")); // The example displays the following output: diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.timespan.custom/cs/customformatexample1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.timespan.custom/cs/customformatexample1.cs index 62836f1727065..ee94d25ded4cb 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.timespan.custom/cs/customformatexample1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.timespan.custom/cs/customformatexample1.cs @@ -10,7 +10,7 @@ public static void Main() string output = null; output = "Time of Travel: " + duration.ToString("%d") + " days"; Console.WriteLine(output); - output = "Time of Travel: " + duration.ToString(@"dd\.hh\:mm\:ss"); + output = "Time of Travel: " + duration.ToString(@"dd\.hh\:mm\:ss"); Console.WriteLine(output); Console.WriteLine("Time of Travel: {0:%d} day(s)", duration); diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.timespan.custom/cs/customparseexample1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.timespan.custom/cs/customparseexample1.cs index 180762e9dcc25..fc92ea5a41a7a 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.timespan.custom/cs/customparseexample1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.timespan.custom/cs/customparseexample1.cs @@ -13,7 +13,7 @@ public static void Main() Console.WriteLine("{0} --> {1}", value, interval.ToString("c")); else Console.WriteLine("Unable to parse '{0}'", value); - + value = "16:32.05"; if (TimeSpan.TryParseExact(value, @"mm\:ss\.ff", null, out interval)) Console.WriteLine("{0} --> {1}", value, interval.ToString("c")); diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.timespan.custom/cs/f_specifiers1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.timespan.custom/cs/f_specifiers1.cs index 1bcbf33b5bdc7..2465dad956382 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.timespan.custom/cs/f_specifiers1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.timespan.custom/cs/f_specifiers1.cs @@ -25,32 +25,32 @@ private static void FSpecifier() Console.WriteLine("Formatting:"); TimeSpan ts1 = TimeSpan.Parse("0:0:3.669"); Console.WriteLine("{0} ('%F') --> {0:%F}", ts1); - + TimeSpan ts2 = TimeSpan.Parse("0:0:3.091"); Console.WriteLine("{0} ('ss\\.F') --> {0:ss\\.F}", ts2); Console.WriteLine(); - + Console.WriteLine("Parsing:"); string[] inputs = { "0:0:03.", "0:0:03.1", "0:0:03.12" }; string fmt = @"h\:m\:ss\.F"; TimeSpan ts3; - + foreach (string input in inputs) { if (TimeSpan.TryParseExact(input, fmt, null, out ts3)) Console.WriteLine("{0} ('{1}') --> {2}", input, fmt, ts3); else - Console.WriteLine("Cannot parse {0} with '{1}'.", + Console.WriteLine("Cannot parse {0} with '{1}'.", input, fmt); - } + } // The example displays the following output: // Formatting: // 00:00:03.6690000 ('%F') --> 6 // 00:00:03.0910000 ('ss\.F') --> 03. - // + // // Parsing: // 0:0:03. ('h\:m\:ss\.F') --> 00:00:03 // 0:0:03.1 ('h\:m\:ss\.F') --> 00:00:03.1000000 - // Cannot parse 0:0:03.12 with 'h\:m\:ss\.F'. + // Cannot parse 0:0:03.12 with 'h\:m\:ss\.F'. // } @@ -60,32 +60,32 @@ private static void FFSpecifier() Console.WriteLine("Formatting:"); TimeSpan ts1 = TimeSpan.Parse("0:0:3.697"); Console.WriteLine("{0} ('FF') --> {0:FF}", ts1); - + TimeSpan ts2 = TimeSpan.Parse("0:0:3.809"); Console.WriteLine("{0} ('ss\\.FF') --> {0:ss\\.FF}", ts2); Console.WriteLine(); - + Console.WriteLine("Parsing:"); string[] inputs = { "0:0:03.", "0:0:03.1", "0:0:03.127" }; string fmt = @"h\:m\:ss\.FF"; TimeSpan ts3; - + foreach (string input in inputs) { if (TimeSpan.TryParseExact(input, fmt, null, out ts3)) Console.WriteLine("{0} ('{1}') --> {2}", input, fmt, ts3); else - Console.WriteLine("Cannot parse {0} with '{1}'.", + Console.WriteLine("Cannot parse {0} with '{1}'.", input, fmt); } // The example displays the following output: // Formatting: // 00:00:03.6970000 ('FF') --> 69 // 00:00:03.8090000 ('ss\.FF') --> 03.8 - // + // // Parsing: // 0:0:03. ('h\:m\:ss\.FF') --> 00:00:03 // 0:0:03.1 ('h\:m\:ss\.FF') --> 00:00:03.1000000 - // Cannot parse 0:0:03.127 with 'h\:m\:ss\.FF'. + // Cannot parse 0:0:03.127 with 'h\:m\:ss\.FF'. // } @@ -95,33 +95,33 @@ private static void FFFSpecifier() Console.WriteLine("Formatting:"); TimeSpan ts1 = TimeSpan.Parse("0:0:3.6974"); Console.WriteLine("{0} ('FFF') --> {0:FFF}", ts1); - + TimeSpan ts2 = TimeSpan.Parse("0:0:3.8009"); Console.WriteLine("{0} ('ss\\.FFF') --> {0:ss\\.FFF}", ts2); Console.WriteLine(); - + Console.WriteLine("Parsing:"); string[] inputs = { "0:0:03.", "0:0:03.12", "0:0:03.1279" }; string fmt = @"h\:m\:ss\.FFF"; TimeSpan ts3; - + foreach (string input in inputs) { if (TimeSpan.TryParseExact(input, fmt, null, out ts3)) Console.WriteLine("{0} ('{1}') --> {2}", input, fmt, ts3); else - Console.WriteLine("Cannot parse {0} with '{1}'.", + Console.WriteLine("Cannot parse {0} with '{1}'.", input, fmt); } // The example displays the following output: // Formatting: // 00:00:03.6974000 ('FFF') --> 697 // 00:00:03.8009000 ('ss\.FFF') --> 03.8 - // + // // Parsing: // 0:0:03. ('h\:m\:ss\.FFF') --> 00:00:03 // 0:0:03.12 ('h\:m\:ss\.FFF') --> 00:00:03.1200000 - // Cannot parse 0:0:03.1279 with 'h\:m\:ss\.FFF'. - // + // Cannot parse 0:0:03.1279 with 'h\:m\:ss\.FFF'. + // } private static void FFFFSpecifier() @@ -130,33 +130,33 @@ private static void FFFFSpecifier() Console.WriteLine("Formatting:"); TimeSpan ts1 = TimeSpan.Parse("0:0:3.69749"); Console.WriteLine("{0} ('FFFF') --> {0:FFFF}", ts1); - + TimeSpan ts2 = TimeSpan.Parse("0:0:3.80009"); Console.WriteLine("{0} ('ss\\.FFFF') --> {0:ss\\.FFFF}", ts2); Console.WriteLine(); - + Console.WriteLine("Parsing:"); string[] inputs = { "0:0:03.", "0:0:03.12", "0:0:03.12795" }; string fmt = @"h\:m\:ss\.FFFF"; TimeSpan ts3; - + foreach (string input in inputs) { if (TimeSpan.TryParseExact(input, fmt, null, out ts3)) Console.WriteLine("{0} ('{1}') --> {2}", input, fmt, ts3); else - Console.WriteLine("Cannot parse {0} with '{1}'.", + Console.WriteLine("Cannot parse {0} with '{1}'.", input, fmt); } // The example displays the following output: // Formatting: // 00:00:03.6974900 ('FFFF') --> 6974 // 00:00:03.8000900 ('ss\.FFFF') --> 03.8 - // + // // Parsing: // 0:0:03. ('h\:m\:ss\.FFFF') --> 00:00:03 // 0:0:03.12 ('h\:m\:ss\.FFFF') --> 00:00:03.1200000 // Cannot parse 0:0:03.12795 with 'h\:m\:ss\.FFFF'. - // + // } private static void FFFFFSpecifier() @@ -165,32 +165,32 @@ private static void FFFFFSpecifier() Console.WriteLine("Formatting:"); TimeSpan ts1 = TimeSpan.Parse("0:0:3.697497"); Console.WriteLine("{0} ('FFFFF') --> {0:FFFFF}", ts1); - + TimeSpan ts2 = TimeSpan.Parse("0:0:3.800009"); Console.WriteLine("{0} ('ss\\.FFFFF') --> {0:ss\\.FFFFF}", ts2); Console.WriteLine(); - + Console.WriteLine("Parsing:"); string[] inputs = { "0:0:03.", "0:0:03.12", "0:0:03.127956" }; string fmt = @"h\:m\:ss\.FFFFF"; TimeSpan ts3; - + foreach (string input in inputs) { if (TimeSpan.TryParseExact(input, fmt, null, out ts3)) Console.WriteLine("{0} ('{1}') --> {2}", input, fmt, ts3); else - Console.WriteLine("Cannot parse {0} with '{1}'.", + Console.WriteLine("Cannot parse {0} with '{1}'.", input, fmt); - } + } // The example displays the following output: // Formatting: // 00:00:03.6974970 ('FFFFF') --> 69749 // 00:00:03.8000090 ('ss\.FFFFF') --> 03.8 - // + // // Parsing: // 0:0:03. ('h\:m\:ss\.FFFF') --> 00:00:03 // 0:0:03.12 ('h\:m\:ss\.FFFF') --> 00:00:03.1200000 - // Cannot parse 0:0:03.127956 with 'h\:m\:ss\.FFFF'. + // Cannot parse 0:0:03.127956 with 'h\:m\:ss\.FFFF'. // } @@ -200,32 +200,32 @@ private static void FFFFFFSpecifier() Console.WriteLine("Formatting:"); TimeSpan ts1 = TimeSpan.Parse("0:0:3.6974974"); Console.WriteLine("{0} ('FFFFFF') --> {0:FFFFFF}", ts1); - + TimeSpan ts2 = TimeSpan.Parse("0:0:3.8000009"); Console.WriteLine("{0} ('ss\\.FFFFFF') --> {0:ss\\.FFFFFF}", ts2); Console.WriteLine(); - + Console.WriteLine("Parsing:"); string[] inputs = { "0:0:03.", "0:0:03.12", "0:0:03.1279569" }; string fmt = @"h\:m\:ss\.FFFFFF"; TimeSpan ts3; - + foreach (string input in inputs) { if (TimeSpan.TryParseExact(input, fmt, null, out ts3)) Console.WriteLine("{0} ('{1}') --> {2}", input, fmt, ts3); else - Console.WriteLine("Cannot parse {0} with '{1}'.", + Console.WriteLine("Cannot parse {0} with '{1}'.", input, fmt); - } + } // The example displays the following output: // Formatting: // 00:00:03.6974974 ('FFFFFF') --> 697497 // 00:00:03.8000009 ('ss\.FFFFFF') --> 03.8 - // + // // Parsing: // 0:0:03. ('h\:m\:ss\.FFFFFF') --> 00:00:03 // 0:0:03.12 ('h\:m\:ss\.FFFFFF') --> 00:00:03.1200000 - // Cannot parse 0:0:03.1279569 with 'h\:m\:ss\.FFFFFF'. + // Cannot parse 0:0:03.1279569 with 'h\:m\:ss\.FFFFFF'. // } @@ -235,32 +235,32 @@ private static void F7Specifier() Console.WriteLine("Formatting:"); TimeSpan ts1 = TimeSpan.Parse("0:0:3.6974974"); Console.WriteLine("{0} ('FFFFFFF') --> {0:FFFFFFF}", ts1); - + TimeSpan ts2 = TimeSpan.Parse("0:0:3.9500000"); Console.WriteLine("{0} ('ss\\.FFFFFFF') --> {0:ss\\.FFFFFFF}", ts2); Console.WriteLine(); - + Console.WriteLine("Parsing:"); string[] inputs = { "0:0:03.", "0:0:03.12", "0:0:03.1279569" }; string fmt = @"h\:m\:ss\.FFFFFFF"; TimeSpan ts3; - + foreach (string input in inputs) { if (TimeSpan.TryParseExact(input, fmt, null, out ts3)) Console.WriteLine("{0} ('{1}') --> {2}", input, fmt, ts3); else - Console.WriteLine("Cannot parse {0} with '{1}'.", + Console.WriteLine("Cannot parse {0} with '{1}'.", input, fmt); } // The example displays the following output: // Formatting: // 00:00:03.6974974 ('FFFFFFF') --> 6974974 // 00:00:03.9500000 ('ss\.FFFFFFF') --> 03.95 - // + // // Parsing: // 0:0:03. ('h\:m\:ss\.FFFFFFF') --> 00:00:03 // 0:0:03.12 ('h\:m\:ss\.FFFFFFF') --> 00:00:03.1200000 - // 0:0:03.1279569 ('h\:m\:ss\.FFFFFFF') --> 00:00:03.1279569 + // 0:0:03.1279569 ('h\:m\:ss\.FFFFFFF') --> 00:00:03.1279569 // } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.timespan.custom/cs/fspecifiers1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.timespan.custom/cs/fspecifiers1.cs index d3e971e24a010..eb7dfaca4918d 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.timespan.custom/cs/fspecifiers1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.timespan.custom/cs/fspecifiers1.cs @@ -9,14 +9,14 @@ public static void Main() string fmt; Console.WriteLine(ts.ToString("c")); Console.WriteLine(); - + for (int ctr = 1; ctr <= 7; ctr++) { fmt = new String('f', ctr); if (fmt.Length == 1) fmt = "%" + fmt; Console.WriteLine("{0,10}: {1:" + fmt + "}", fmt, ts); - } + } Console.WriteLine(); - + for (int ctr = 1; ctr <= 7; ctr++) { fmt = new String('f', ctr); Console.WriteLine("{0,10}: {1:s\\." + fmt + "}", "s\\." + fmt, ts); @@ -29,14 +29,14 @@ public static void Main() // fffff: 87654 // ffffff: 876543 // fffffff: 8765432 - // + // // s\.f: 29.8 // s\.ff: 29.87 // s\.fff: 29.876 // s\.ffff: 29.8765 // s\.fffff: 29.87654 // s\.ffffff: 29.876543 - // s\.fffffff: 29.8765432 + // s\.fffffff: 29.8765432 // } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.timespan.custom/cs/literal1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.timespan.custom/cs/literal1.cs index 55ada10bfa903..1826c24655c54 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.timespan.custom/cs/literal1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.timespan.custom/cs/literal1.cs @@ -10,11 +10,11 @@ public static void Main() string fmt = @"mm\:ss\ \m\i\n\u\t\e\s"; Console.WriteLine(interval.ToString(fmt)); // Delimit literal characters in a format string with the ' symbol. - fmt = "mm':'ss' minutes'"; + fmt = "mm':'ss' minutes'"; Console.WriteLine(interval.ToString(fmt)); - // The example displays the following output: - // 32:45 minutes - // 32:45 minutes + // The example displays the following output: + // 32:45 minutes + // 32:45 minutes // } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.timespan.custom/cs/negativevalues1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.timespan.custom/cs/negativevalues1.cs index a67b165bb6794..99cf9d858df7d 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.timespan.custom/cs/negativevalues1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.timespan.custom/cs/negativevalues1.cs @@ -5,9 +5,9 @@ public class Example { public static void Main() { - TimeSpan result = new DateTime(2010, 01, 01) - DateTime.Now; + TimeSpan result = new DateTime(2010, 01, 01) - DateTime.Now; String fmt = (result < TimeSpan.Zero ? "\\-" : "") + "dd\\.hh\\:mm"; - + Console.WriteLine(result.ToString(fmt)); Console.WriteLine("Interval: {0:" + fmt + "}", result); } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.timespan.standard/cs/formatexample1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.timespan.standard/cs/formatexample1.cs index c47dae7825f85..0613f233a06b9 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.timespan.standard/cs/formatexample1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.timespan.standard/cs/formatexample1.cs @@ -8,8 +8,8 @@ public static void Main() TimeSpan duration = new TimeSpan(1, 12, 23, 62); string output = "Time of Travel: " + duration.ToString("c"); Console.WriteLine(output); - - Console.WriteLine("Time of Travel: {0:c}", duration); + + Console.WriteLine("Time of Travel: {0:c}", duration); } } // The example displays the following output: diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.timespan.standard/cs/parseexample1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.timespan.standard/cs/parseexample1.cs index e13c45dec283e..021e3e3b35ea8 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.timespan.standard/cs/parseexample1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.timespan.standard/cs/parseexample1.cs @@ -10,18 +10,18 @@ public static void Main() try { interval = TimeSpan.ParseExact(value, "c", null); Console.WriteLine("Converted '{0}' to {1}", value, interval); - } + } catch (FormatException) { Console.WriteLine("{0}: Bad Format", value); - } + } catch (OverflowException) { Console.WriteLine("{0}: Out of Range", value); } - + if (TimeSpan.TryParseExact(value, "c", null, out interval)) Console.WriteLine("Converted '{0}' to {1}", value, interval); else - Console.WriteLine("Unable to convert {0} to a time interval.", + Console.WriteLine("Unable to convert {0} to a time interval.", value); } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.timespan.standard/cs/standardc1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.timespan.standard/cs/standardc1.cs index 57f2ab1946d28..11178cfc6e230 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.timespan.standard/cs/standardc1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.timespan.standard/cs/standardc1.cs @@ -8,15 +8,15 @@ public static void Main() TimeSpan interval1, interval2; interval1 = new TimeSpan(7, 45, 16); interval2 = new TimeSpan(18, 12, 38); - - Console.WriteLine("{0:c} - {1:c} = {2:c}", interval1, + + Console.WriteLine("{0:c} - {1:c} = {2:c}", interval1, interval2, interval1 - interval2); - Console.WriteLine("{0:c} + {1:c} = {2:c}", interval1, + Console.WriteLine("{0:c} + {1:c} = {2:c}", interval1, interval2, interval1 + interval2); - + interval1 = new TimeSpan(0, 0, 1, 14, 365); - interval2 = TimeSpan.FromTicks(2143756); - Console.WriteLine("{0:c} + {1:c} = {2:c}", interval1, + interval2 = TimeSpan.FromTicks(2143756); + Console.WriteLine("{0:c} + {1:c} = {2:c}", interval1, interval2, interval1 + interval2); } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.timespan.standard/cs/standardlong1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.timespan.standard/cs/standardlong1.cs index 0758953a6b86b..34e30b9536c6f 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.timespan.standard/cs/standardlong1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.timespan.standard/cs/standardlong1.cs @@ -9,16 +9,16 @@ public static void Main() TimeSpan interval1, interval2; interval1 = new TimeSpan(7, 45, 16); interval2 = new TimeSpan(18, 12, 38); - - Console.WriteLine("{0:G} - {1:G} = {2:G}", interval1, + + Console.WriteLine("{0:G} - {1:G} = {2:G}", interval1, interval2, interval1 - interval2); - Console.WriteLine(String.Format(new CultureInfo("fr-FR"), - "{0:G} + {1:G} = {2:G}", interval1, + Console.WriteLine(String.Format(new CultureInfo("fr-FR"), + "{0:G} + {1:G} = {2:G}", interval1, interval2, interval1 + interval2)); - + interval1 = new TimeSpan(0, 0, 1, 14, 36); - interval2 = TimeSpan.FromTicks(2143756); - Console.WriteLine("{0:G} + {1:G} = {2:G}", interval1, + interval2 = TimeSpan.FromTicks(2143756); + Console.WriteLine("{0:G} + {1:G} = {2:G}", interval1, interval2, interval1 + interval2); } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.timespan.standard/cs/standardshort1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.timespan.standard/cs/standardshort1.cs index 22dcf076e6d65..d3f6005b9433a 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.timespan.standard/cs/standardshort1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.timespan.standard/cs/standardshort1.cs @@ -9,16 +9,16 @@ public static void Main() TimeSpan interval1, interval2; interval1 = new TimeSpan(7, 45, 16); interval2 = new TimeSpan(18, 12, 38); - - Console.WriteLine("{0:g} - {1:g} = {2:g}", interval1, + + Console.WriteLine("{0:g} - {1:g} = {2:g}", interval1, interval2, interval1 - interval2); - Console.WriteLine(String.Format(new CultureInfo("fr-FR"), - "{0:g} + {1:g} = {2:g}", interval1, + Console.WriteLine(String.Format(new CultureInfo("fr-FR"), + "{0:g} + {1:g} = {2:g}", interval1, interval2, interval1 + interval2)); - + interval1 = new TimeSpan(0, 0, 1, 14, 36); - interval2 = TimeSpan.FromTicks(2143756); - Console.WriteLine("{0:g} + {1:g} = {2:g}", interval1, + interval2 = TimeSpan.FromTicks(2143756); + Console.WriteLine("{0:g} + {1:g} = {2:g}", interval1, interval2, interval1 + interval2); } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.types.dynamic/cs/source1.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.types.dynamic/cs/source1.cs index f28bf1238d271..3a5d195ca0def 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.types.dynamic/cs/source1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.types.dynamic/cs/source1.cs @@ -35,16 +35,16 @@ static void Main() MySimpleClass myInstance = new MySimpleClass(); MyCustomBinder myCustomBinder = new MyCustomBinder(); - // Get the method information for the particular overload + // Get the method information for the particular overload // being sought. - MethodInfo myMethod = myType.GetMethod("MyMethod", + MethodInfo myMethod = myType.GetMethod("MyMethod", BindingFlags.Public | BindingFlags.Instance, - myCustomBinder, new Type[] {typeof(string), + myCustomBinder, new Type[] {typeof(string), typeof(int)}, null); Console.WriteLine(myMethod.ToString()); - + // Invoke the overload. - myType.InvokeMember("MyMethod", BindingFlags.InvokeMethod, + myType.InvokeMember("MyMethod", BindingFlags.InvokeMethod, myCustomBinder, myInstance, new Object[] {"Testing...", (int)32}); } @@ -85,7 +85,7 @@ public override MethodBase BindToMethod( return null; } - public override FieldInfo BindToField(BindingFlags bindingAttr, + public override FieldInfo BindToField(BindingFlags bindingAttr, FieldInfo[] match, object value, CultureInfo culture) { if (match == null) diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.types.dynamic/cs/source2.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.types.dynamic/cs/source2.cs index d808100105182..163eb14229fd1 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.types.dynamic/cs/source2.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.types.dynamic/cs/source2.cs @@ -33,7 +33,7 @@ public override MethodBase BindToMethod( return null; } - public override FieldInfo BindToField(BindingFlags bindingAttr, + public override FieldInfo BindToField(BindingFlags bindingAttr, FieldInfo[] match, object value, CultureInfo culture) { if (match == null) @@ -196,7 +196,7 @@ public static void PrintValue(long value) { Console.WriteLine("PrintValue({0})", value); } - + public static void PrintValue(string value) { Console.WriteLine("PrintValue\"{0}\")", value); diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.types.enum/cs/example.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.types.enum/cs/example.cs index ba37b5ace051f..8b5725dbd59e3 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.types.enum/cs/example.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.types.enum/cs/example.cs @@ -31,24 +31,24 @@ public static void Main() AvailableIn[SomeRootVegetables.HorseRadish] = Seasons.All; AvailableIn[SomeRootVegetables.Radish] = Seasons.Spring; - AvailableIn[SomeRootVegetables.Turnip] = Seasons.Spring | + AvailableIn[SomeRootVegetables.Turnip] = Seasons.Spring | Seasons.Autumn; // Array of the seasons, using the enumeration. - Seasons[] theSeasons = new Seasons[] { Seasons.Summer, Seasons.Autumn, + Seasons[] theSeasons = new Seasons[] { Seasons.Summer, Seasons.Autumn, Seasons.Winter, Seasons.Spring }; // Print information of what vegetables are available each season. foreach (Seasons season in theSeasons) { Console.Write(String.Format( - "The following root vegetables are harvested in {0}:\n", + "The following root vegetables are harvested in {0}:\n", season.ToString("G"))); foreach (KeyValuePair item in AvailableIn) { // A bitwise comparison. if (((Seasons)item.Value & season) > 0) - Console.Write(String.Format(" {0:G}\n", + Console.Write(String.Format(" {0:G}\n", (SomeRootVegetables)item.Key)); } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.types.members.fields/cs/example.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.types.members.fields/cs/example.cs index 622b146c715cc..451dce1841310 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.types.members.fields/cs/example.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.types.members.fields/cs/example.cs @@ -5,7 +5,7 @@ public class Constants { public const double Pi = 3.1416; public readonly DateTime BirthDate; - + public Constants(DateTime birthDate) { this.BirthDate = birthDate; diff --git a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.types.members.properties/cs/example.cs b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.types.members.properties/cs/example.cs index 4f6b521918b16..8f6c160c25e90 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/conceptual.types.members.properties/cs/example.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/conceptual.types.members.properties/cs/example.cs @@ -4,9 +4,9 @@ public class Person { private int m_Age; - + public int Age - { + { get { return m_Age; } set { if (value < 0 || value > 125) @@ -16,7 +16,7 @@ public int Age else { m_Age = value; - } + } } } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/contractexample/cs/program.cs b/samples/snippets/csharp/VS_Snippets_CLR/contractexample/cs/program.cs index ae0bd2b7dc751..41c98125c1e5d 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/contractexample/cs/program.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/contractexample/cs/program.cs @@ -4,7 +4,7 @@ using System; using System.Diagnostics.Contracts; -// An IArray is an ordered collection of objects. +// An IArray is an ordered collection of objects. [ContractClass(typeof(IArrayContract))] public interface IArray { @@ -20,7 +20,7 @@ int Count get; } - // Adds an item to the list. + // Adds an item to the list. // The return value is the position the new element was inserted in. int Add(Object value); @@ -28,7 +28,7 @@ int Count void Clear(); // Inserts value into the array at position index. - // index must be non-negative and less than or equal to the + // index must be non-negative and less than or equal to the // number of elements in the array. If index equals the number // of items in the array, then value is appended to the end. void Insert(int index, Object value); diff --git a/samples/snippets/csharp/VS_Snippets_CLR/eventsoverview/cs/programnodata.cs b/samples/snippets/csharp/VS_Snippets_CLR/eventsoverview/cs/programnodata.cs index 4e35933043b94..561fa2638a324 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/eventsoverview/cs/programnodata.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/eventsoverview/cs/programnodata.cs @@ -21,7 +21,7 @@ static void Main(string[] args) static void c_ThresholdReached(object sender, EventArgs e) { Console.WriteLine("The threshold was reached."); - Environment.Exit(0); + Environment.Exit(0); } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/formatting.numeric.custom/cs/custom.cs b/samples/snippets/csharp/VS_Snippets_CLR/formatting.numeric.custom/cs/custom.cs index 6194357a2a5fa..503d4029ee4e9 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/formatting.numeric.custom/cs/custom.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/formatting.numeric.custom/cs/custom.cs @@ -32,61 +32,61 @@ public static void Main() Console.WriteLine("Per Mille Placeholder:"); ShowPerMillePlaceholder(); } - + private static void ShowZeroPlaceholder() { // double value; - + value = 123; Console.WriteLine(value.ToString("00000")); Console.WriteLine(String.Format("{0:00000}", value)); // Displays 00123 - + value = 1.2; Console.WriteLine(value.ToString("0.00", CultureInfo.InvariantCulture)); - Console.WriteLine(String.Format(CultureInfo.InvariantCulture, + Console.WriteLine(String.Format(CultureInfo.InvariantCulture, "{0:0.00}", value)); // Displays 1.20 Console.WriteLine(value.ToString("00.00", CultureInfo.InvariantCulture)); - Console.WriteLine(String.Format(CultureInfo.InvariantCulture, + Console.WriteLine(String.Format(CultureInfo.InvariantCulture, "{0:00.00}", value)); // Displays 01.20 CultureInfo daDK = CultureInfo.CreateSpecificCulture("da-DK"); - Console.WriteLine(value.ToString("00.00", daDK)); + Console.WriteLine(value.ToString("00.00", daDK)); Console.WriteLine(String.Format(daDK, "{0:00.00}", value)); // Displays 01,20 - + value = .56; Console.WriteLine(value.ToString("0.0", CultureInfo.InvariantCulture)); - Console.WriteLine(String.Format(CultureInfo.InvariantCulture, + Console.WriteLine(String.Format(CultureInfo.InvariantCulture, "{0:0.0}", value)); // Displays 0.6 value = 1234567890; Console.WriteLine(value.ToString("0,0", CultureInfo.InvariantCulture)); - Console.WriteLine(String.Format(CultureInfo.InvariantCulture, + Console.WriteLine(String.Format(CultureInfo.InvariantCulture, "{0:0,0}", value)); - // Displays 1,234,567,890 - + // Displays 1,234,567,890 + CultureInfo elGR = CultureInfo.CreateSpecificCulture("el-GR"); Console.WriteLine(value.ToString("0,0", elGR)); Console.WriteLine(String.Format(elGR, "{0:0,0}", value)); // Displays 1.234.567.890 - + value = 1234567890.123456; Console.WriteLine(value.ToString("0,0.0", CultureInfo.InvariantCulture)); - Console.WriteLine(String.Format(CultureInfo.InvariantCulture, + Console.WriteLine(String.Format(CultureInfo.InvariantCulture, "{0:0,0.0}", value)); - // Displays 1,234,567,890.1 - + // Displays 1,234,567,890.1 + value = 1234.567890; Console.WriteLine(value.ToString("0,0.00", CultureInfo.InvariantCulture)); - Console.WriteLine(String.Format(CultureInfo.InvariantCulture, + Console.WriteLine(String.Format(CultureInfo.InvariantCulture, "{0:0,0.00}", value)); - // Displays 1,234.57 + // Displays 1,234.57 // } @@ -94,68 +94,68 @@ private static void ShowDigitPlaceholder() { // double value; - + value = 1.2; Console.WriteLine(value.ToString("#.##", CultureInfo.InvariantCulture)); - Console.WriteLine(String.Format(CultureInfo.InvariantCulture, + Console.WriteLine(String.Format(CultureInfo.InvariantCulture, "{0:#.##}", value)); // Displays 1.2 - + value = 123; Console.WriteLine(value.ToString("#####")); Console.WriteLine(String.Format("{0:#####}", value)); // Displays 123 value = 123456; - Console.WriteLine(value.ToString("[##-##-##]")); - Console.WriteLine(String.Format("{0:[##-##-##]}", value)); + Console.WriteLine(value.ToString("[##-##-##]")); + Console.WriteLine(String.Format("{0:[##-##-##]}", value)); // Displays [12-34-56] value = 1234567890; Console.WriteLine(value.ToString("#")); Console.WriteLine(String.Format("{0:#}", value)); // Displays 1234567890 - + Console.WriteLine(value.ToString("(###) ###-####")); Console.WriteLine(String.Format("{0:(###) ###-####}", value)); // Displays (123) 456-7890 - // + // } private static void ShowDecimalPoint() { // double value; - + value = 1.2; Console.WriteLine(value.ToString("0.00", CultureInfo.InvariantCulture)); - Console.WriteLine(String.Format(CultureInfo.InvariantCulture, + Console.WriteLine(String.Format(CultureInfo.InvariantCulture, "{0:0.00}", value)); // Displays 1.20 Console.WriteLine(value.ToString("00.00", CultureInfo.InvariantCulture)); - Console.WriteLine(String.Format(CultureInfo.InvariantCulture, + Console.WriteLine(String.Format(CultureInfo.InvariantCulture, "{0:00.00}", value)); // Displays 01.20 - Console.WriteLine(value.ToString("00.00", + Console.WriteLine(value.ToString("00.00", CultureInfo.CreateSpecificCulture("da-DK"))); Console.WriteLine(String.Format(CultureInfo.CreateSpecificCulture("da-DK"), "{0:00.00}", value)); // Displays 01,20 value = .086; - Console.WriteLine(value.ToString("#0.##%", CultureInfo.InvariantCulture)); - Console.WriteLine(String.Format(CultureInfo.InvariantCulture, - "{0:#0.##%}", value)); + Console.WriteLine(value.ToString("#0.##%", CultureInfo.InvariantCulture)); + Console.WriteLine(String.Format(CultureInfo.InvariantCulture, + "{0:#0.##%}", value)); // Displays 8.6% - + value = 86000; Console.WriteLine(value.ToString("0.###E+0", CultureInfo.InvariantCulture)); - Console.WriteLine(String.Format(CultureInfo.InvariantCulture, + Console.WriteLine(String.Format(CultureInfo.InvariantCulture, "{0:0.###E+0}", value)); // Displays 8.6E+4 - // + // } private static void ShowThousandSpecifier() @@ -163,34 +163,34 @@ private static void ShowThousandSpecifier() // double value = 1234567890; Console.WriteLine(value.ToString("#,#", CultureInfo.InvariantCulture)); - Console.WriteLine(String.Format(CultureInfo.InvariantCulture, + Console.WriteLine(String.Format(CultureInfo.InvariantCulture, "{0:#,#}", value)); - // Displays 1,234,567,890 + // Displays 1,234,567,890 Console.WriteLine(value.ToString("#,##0,,", CultureInfo.InvariantCulture)); - Console.WriteLine(String.Format(CultureInfo.InvariantCulture, + Console.WriteLine(String.Format(CultureInfo.InvariantCulture, "{0:#,##0,,}", value)); // Displays 1,235 // } - + private static void ShowScalingSpecifier() { // double value = 1234567890; Console.WriteLine(value.ToString("#,,", CultureInfo.InvariantCulture)); - Console.WriteLine(String.Format(CultureInfo.InvariantCulture, + Console.WriteLine(String.Format(CultureInfo.InvariantCulture, "{0:#,,}", value)); - // Displays 1235 - + // Displays 1235 + Console.WriteLine(value.ToString("#,,,", CultureInfo.InvariantCulture)); - Console.WriteLine(String.Format(CultureInfo.InvariantCulture, + Console.WriteLine(String.Format(CultureInfo.InvariantCulture, "{0:#,,,}", value)); - // Displays 1 - - Console.WriteLine(value.ToString("#,##0,,", CultureInfo.InvariantCulture)); - Console.WriteLine(String.Format(CultureInfo.InvariantCulture, - "{0:#,##0,,}", value)); + // Displays 1 + + Console.WriteLine(value.ToString("#,##0,,", CultureInfo.InvariantCulture)); + Console.WriteLine(String.Format(CultureInfo.InvariantCulture, + "{0:#,##0,,}", value)); // Displays 1,235 // } @@ -200,28 +200,28 @@ private static void ShowPercentagePlaceholder() // double value = .086; Console.WriteLine(value.ToString("#0.##%", CultureInfo.InvariantCulture)); - Console.WriteLine(String.Format(CultureInfo.InvariantCulture, + Console.WriteLine(String.Format(CultureInfo.InvariantCulture, "{0:#0.##%}", value)); - // Displays 8.6% + // Displays 8.6% // } - + private static void ShowScientificNotation() { // double value = 86000; Console.WriteLine(value.ToString("0.###E+0", CultureInfo.InvariantCulture)); - Console.WriteLine(String.Format(CultureInfo.InvariantCulture, + Console.WriteLine(String.Format(CultureInfo.InvariantCulture, "{0:0.###E+0}", value)); // Displays 8.6E+4 - + Console.WriteLine(value.ToString("0.###E+000", CultureInfo.InvariantCulture)); - Console.WriteLine(String.Format(CultureInfo.InvariantCulture, + Console.WriteLine(String.Format(CultureInfo.InvariantCulture, "{0:0.###E+000}", value)); // Displays 8.6E+004 - + Console.WriteLine(value.ToString("0.###E-000", CultureInfo.InvariantCulture)); - Console.WriteLine(String.Format(CultureInfo.InvariantCulture, + Console.WriteLine(String.Format(CultureInfo.InvariantCulture, "{0:0.###E-000}", value)); // Displays 8.6E004 // @@ -237,15 +237,15 @@ private static void ShowSectionSpecifier() string fmt2 = "##;(##)"; string fmt3 = "##;(##);**Zero**"; - Console.WriteLine(posValue.ToString(fmt2)); - Console.WriteLine(String.Format("{0:" + fmt2 + "}", posValue)); + Console.WriteLine(posValue.ToString(fmt2)); + Console.WriteLine(String.Format("{0:" + fmt2 + "}", posValue)); // Displays 1234 - Console.WriteLine(negValue.ToString(fmt2)); - Console.WriteLine(String.Format("{0:" + fmt2 + "}", negValue)); + Console.WriteLine(negValue.ToString(fmt2)); + Console.WriteLine(String.Format("{0:" + fmt2 + "}", negValue)); // Displays (1234) - - Console.WriteLine(zeroValue.ToString(fmt3)); + + Console.WriteLine(zeroValue.ToString(fmt3)); Console.WriteLine(String.Format("{0:" + fmt3 + "}", zeroValue)); // Displays **Zero** // @@ -257,9 +257,9 @@ private static void ShowPerMillePlaceholder() double value = .00354; string perMilleFmt = "#0.## " + '\u2030'; Console.WriteLine(value.ToString(perMilleFmt, CultureInfo.InvariantCulture)); - Console.WriteLine(String.Format(CultureInfo.InvariantCulture, + Console.WriteLine(String.Format(CultureInfo.InvariantCulture, "{0:" + perMilleFmt + "}", value)); - // Displays 3.54‰ + // Displays 3.54‰ // } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/formatting.numeric.custom/cs/escape1.cs b/samples/snippets/csharp/VS_Snippets_CLR/formatting.numeric.custom/cs/escape1.cs index 8e0c3a90d57ab..fa63b996b922e 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/formatting.numeric.custom/cs/escape1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/formatting.numeric.custom/cs/escape1.cs @@ -10,7 +10,7 @@ public static void Main() Console.WriteLine(String.Format("{0:\\#\\#\\# ##0 dollars and \\0\\0 cents \\#\\#\\#}", value)); // Displays ### 123 dollars and 00 cents ### - + Console.WriteLine(value.ToString(@"\#\#\# ##0 dollars and \0\0 cents \#\#\#")); Console.WriteLine(String.Format(@"{0:\#\#\# ##0 dollars and \0\0 cents \#\#\#}", value)); @@ -20,7 +20,7 @@ public static void Main() Console.WriteLine(String.Format("{0:\\\\\\\\\\\\ ##0 dollars and \\0\\0 cents \\\\\\\\\\\\}", value)); // Displays \\\ 123 dollars and 00 cents \\\ - + Console.WriteLine(value.ToString(@"\\\\\\ ##0 dollars and \0\0 cents \\\\\\")); Console.WriteLine(String.Format(@"{0:\\\\\\ ##0 dollars and \0\0 cents \\\\\\}", value)); diff --git a/samples/snippets/csharp/VS_Snippets_CLR/formatting.numeric.custom/cs/example1.cs b/samples/snippets/csharp/VS_Snippets_CLR/formatting.numeric.custom/cs/example1.cs index bf98d3a761b74..69303b69d6be9 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/formatting.numeric.custom/cs/example1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/formatting.numeric.custom/cs/example1.cs @@ -8,13 +8,13 @@ public static void Main() double number1 = 1234567890; string value1 = number1.ToString("(###) ###-####"); Console.WriteLine(value1); - + int number2 = 42; string value2 = number2.ToString("My Number = #"); Console.WriteLine(value2); // The example displays the following output: // (123) 456-7890 // My Number = 42 - // + // } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/formatting.numeric.custom/literal2.cs b/samples/snippets/csharp/VS_Snippets_CLR/formatting.numeric.custom/literal2.cs index 5f71752acd9d0..f17a44f3c0079 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/formatting.numeric.custom/literal2.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/formatting.numeric.custom/literal2.cs @@ -8,7 +8,7 @@ public static void Main() double n = 123.8; Console.WriteLine($"{n:#,##0.0K}"); // The example displays the following output: - // 123.8K + // 123.8K // } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/generatingahash/cs/program.cs b/samples/snippets/csharp/VS_Snippets_CLR/generatingahash/cs/program.cs index a1823a49449fc..1bdf078622b18 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/generatingahash/cs/program.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/generatingahash/cs/program.cs @@ -12,21 +12,21 @@ static void Main(string[] args) string messageString = "This is the original message!"; - //Create a new instance of the UnicodeEncoding class to + //Create a new instance of the UnicodeEncoding class to //convert the string into an array of Unicode bytes. UnicodeEncoding ue = new UnicodeEncoding(); //Convert the string into an array of bytes. byte[] messageBytes = ue.GetBytes(messageString); - //Create a new instance of the SHA1Managed class to create + //Create a new instance of the SHA1Managed class to create //the hash value. SHA1Managed shHash = new SHA1Managed(); //Create the hash value from the array of bytes. hashValue = shHash.ComputeHash(messageBytes); - //Display the hash value to the console. + //Display the hash value to the console. foreach (byte b in hashValue) { Console.Write("{0} ", b); diff --git a/samples/snippets/csharp/VS_Snippets_CLR/parsing.numbers/cs/formatproviders1.cs b/samples/snippets/csharp/VS_Snippets_CLR/parsing.numbers/cs/formatproviders1.cs index 699e351473f03..8b36141890f42 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/parsing.numbers/cs/formatproviders1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/parsing.numbers/cs/formatproviders1.cs @@ -6,19 +6,19 @@ public class Example { public static void Main() { - string[] values = { "1,304.16", "$1,456.78", "1,094", "152", + string[] values = { "1,304.16", "$1,456.78", "1,094", "152", "123,45 €", "1 304,16", "Ae9f" }; double number; CultureInfo culture = null; - + foreach (string value in values) { try { culture = CultureInfo.CreateSpecificCulture("en-US"); number = Double.Parse(value, culture); Console.WriteLine("{0}: {1} --> {2}", culture.Name, value, number); - } + } catch (FormatException) { - Console.WriteLine("{0}: Unable to parse '{1}'.", + Console.WriteLine("{0}: Unable to parse '{1}'.", culture.Name, value); culture = CultureInfo.CreateSpecificCulture("fr-FR"); try { @@ -26,30 +26,30 @@ public static void Main() Console.WriteLine("{0}: {1} --> {2}", culture.Name, value, number); } catch (FormatException) { - Console.WriteLine("{0}: Unable to parse '{1}'.", + Console.WriteLine("{0}: Unable to parse '{1}'.", culture.Name, value); } } Console.WriteLine(); - } + } } } // The example displays the following output: // en-US: 1,304.16 --> 1304.16 -// +// // en-US: Unable to parse '$1,456.78'. // fr-FR: Unable to parse '$1,456.78'. -// +// // en-US: 1,094 --> 1094 -// +// // en-US: 152 --> 152 -// +// // en-US: Unable to parse '123,45 €'. // fr-FR: Unable to parse '123,45 €'. -// +// // en-US: Unable to parse '1 304,16'. // fr-FR: 1 304,16 --> 1304.16 -// +// // en-US: Unable to parse 'Ae9f'. // fr-FR: Unable to parse 'Ae9f'. // diff --git a/samples/snippets/csharp/VS_Snippets_CLR/parsing.numbers/cs/styles1.cs b/samples/snippets/csharp/VS_Snippets_CLR/parsing.numbers/cs/styles1.cs index 80e3e5a06aab8..c6290d0fda315 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/parsing.numbers/cs/styles1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/parsing.numbers/cs/styles1.cs @@ -13,8 +13,8 @@ public static void Main() Console.WriteLine("{0} --> {1}", value, number); else Console.WriteLine("Unable to convert '{0}'", value); - - if (Int32.TryParse(value, NumberStyles.Integer | NumberStyles.AllowThousands, + + if (Int32.TryParse(value, NumberStyles.Integer | NumberStyles.AllowThousands, provider, out number)) Console.WriteLine("{0} --> {1}", value, number); else diff --git a/samples/snippets/csharp/VS_Snippets_CLR/parsing.numbers/cs/unicode1.cs b/samples/snippets/csharp/VS_Snippets_CLR/parsing.numbers/cs/unicode1.cs index b3cf9a2e05302..495add3a7bf19 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/parsing.numbers/cs/unicode1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/parsing.numbers/cs/unicode1.cs @@ -13,11 +13,11 @@ public static void Main() // Define a string of Fullwidth digits 1-5. value = "\uFF11\uFF12\uFF13\uFF14\uFF15"; ParseDigits(value); - + // Define a string of Arabic-Indic digits 1-5. value = "\u0661\u0662\u0663\u0664\u0665"; ParseDigits(value); - + // Define a string of Bangla digits 1-5. value = "\u09e7\u09e8\u09e9\u09ea\u09eb"; ParseDigits(value); @@ -28,10 +28,10 @@ static void ParseDigits(string value) try { int number = Int32.Parse(value); Console.WriteLine("'{0}' --> {1}", value, number); - } + } catch (FormatException) { - Console.WriteLine("Unable to parse '{0}'.", value); - } + Console.WriteLine("Unable to parse '{0}'.", value); + } } } // The example displays the following output: diff --git a/samples/snippets/csharp/VS_Snippets_CLR/portableclasslibrarymvvm/cs/customer.cs b/samples/snippets/csharp/VS_Snippets_CLR/portableclasslibrarymvvm/cs/customer.cs index f00e151e7ccd5..c1638cb183403 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/portableclasslibrarymvvm/cs/customer.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/portableclasslibrarymvvm/cs/customer.cs @@ -2,13 +2,13 @@ using System; namespace SimpleMVVM.Model -{ +{ public class Customer { public int CustomerID { - get; - set; + get; + set; } public string FullName @@ -19,7 +19,7 @@ public string FullName public string Phone { - get; + get; set; } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/projectn/cs/compat2.cs b/samples/snippets/csharp/VS_Snippets_CLR/projectn/cs/compat2.cs index f4059ccf96d22..ba111f4ea9a6a 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/projectn/cs/compat2.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/projectn/cs/compat2.cs @@ -10,6 +10,6 @@ public static void Main() // class A {} -class B : A>> +class B : A>> {} // diff --git a/samples/snippets/csharp/VS_Snippets_CLR/projectn/cs/compat3.cs b/samples/snippets/csharp/VS_Snippets_CLR/projectn/cs/compat3.cs index 8ade9fcccac74..590cdda206353 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/projectn/cs/compat3.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/projectn/cs/compat3.cs @@ -8,5 +8,5 @@ public class X public InnerType instance { get; set; } } -public class Y : X {} +public class Y : X {} // diff --git a/samples/snippets/csharp/VS_Snippets_CLR/projectn/cs/makegenericmethod1.cs b/samples/snippets/csharp/VS_Snippets_CLR/projectn/cs/makegenericmethod1.cs index 04e200b895216..ea0dcff2ca84a 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/projectn/cs/makegenericmethod1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/projectn/cs/makegenericmethod1.cs @@ -24,7 +24,7 @@ public void GetMethod(T t) if (t == null) { Console.WriteLine("t is null!"); return; - } + } Console.WriteLine(t.GetType().Name); Console.WriteLine("The value is {0}", t); } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/projectn/cs/serialize1.cs b/samples/snippets/csharp/VS_Snippets_CLR/projectn/cs/serialize1.cs index 813a2b237b2cb..d074f2ee6efe9 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/projectn/cs/serialize1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/projectn/cs/serialize1.cs @@ -12,7 +12,7 @@ public static void Main() DataContractSerializer dataSer = new DataContractSerializer(typeof(T)); DataContractJsonSerializer jsonSer = new DataContractJsonSerializer(typeof(T)); // - + // Type t = typeof(DataSet); XmlSerializer ser = new XmlSerializer(t); @@ -22,9 +22,9 @@ public static void Main() public void UsesReflection() { // - XmlSerializer xSerializer = new XmlSerializer(typeof(Teacher), - new Type[] { typeof(Student), - typeof(Course), + XmlSerializer xSerializer = new XmlSerializer(typeof(Teacher), + new Type[] { typeof(Student), + typeof(Course), typeof(Location) }); // } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/projectn/cs/type_makegenerictype1.cs b/samples/snippets/csharp/VS_Snippets_CLR/projectn/cs/type_makegenerictype1.cs index 08901a5e882a9..d93725ffe81b1 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/projectn/cs/type_makegenerictype1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/projectn/cs/type_makegenerictype1.cs @@ -5,10 +5,10 @@ namespace App1 public class AppClass { // private T type; - + public AppClass() { -// this.type = type; +// this.type = type; } } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/projectn_etw/cs/etw1.cs b/samples/snippets/csharp/VS_Snippets_CLR/projectn_etw/cs/etw1.cs index c817ce618486a..96120a8729408 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/projectn_etw/cs/etw1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/projectn_etw/cs/etw1.cs @@ -8,10 +8,10 @@ public sealed class AppEventSource : EventSource public static AppEventSource Log = new AppEventSource (); // The numbers passed to WriteEvent and EventAttribute - // must increment with each logging method. + // must increment with each logging method. [Event(1)] public void AppInitialized() { WriteEvent(1, ""); } - + [Event(2)] public void MainPageInitialized() { WriteEvent(2, ""); } } @@ -25,7 +25,7 @@ public App() this.Suspending += OnSuspending; AppEventSource.Log.AppInitialized(); } -} +} public sealed partial class MainPage : Page { @@ -36,12 +36,12 @@ public MainPage() } } -public class Page +public class Page { - public void InitializeComponent() {} + public void InitializeComponent() {} } -public sealed partial class App +public sealed partial class App { - public void InitializeComponent() {} + public void InitializeComponent() {} } \ No newline at end of file diff --git a/samples/snippets/csharp/VS_Snippets_CLR/projectn_etw/cs/etw2.cs b/samples/snippets/csharp/VS_Snippets_CLR/projectn_etw/cs/etw2.cs index a352caeed192b..d8d6c63c2b6d9 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/projectn_etw/cs/etw2.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/projectn_etw/cs/etw2.cs @@ -3,7 +3,7 @@ // using System; using Windows.ApplicationModel; -using Windows.UI.Xaml; +using Windows.UI.Xaml; public sealed partial class App { @@ -13,7 +13,7 @@ public App() this.Suspending += OnSuspending; AppEventSource.Log.AppInitialized(); } -} +} public sealed partial class MainPage : Page { public MainPage() @@ -24,12 +24,12 @@ public MainPage() } // -public class Page +public class Page { - public void InitializeComponent() {} + public void InitializeComponent() {} } -public sealed partial class App : Application +public sealed partial class App : Application { public void InitializeComponent() {} @@ -44,10 +44,10 @@ public sealed class AppEventSource : EventSource public static AppEventSource Log = new AppEventSource (); // The numbers passed to WriteEvent and EventAttribute - // must increment with each logging method. + // must increment with each logging method. [Event(1)] public void AppInitialized() { WriteEvent(1); } - + [Event(2)] public void MainPageInitialized() { WriteEvent(2); } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/projectn_reflection/cs/browsegenerictype1.cs b/samples/snippets/csharp/VS_Snippets_CLR/projectn_reflection/cs/browsegenerictype1.cs index 167e6e1ac614c..d3c684e1b51b4 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/projectn_reflection/cs/browsegenerictype1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/projectn_reflection/cs/browsegenerictype1.cs @@ -36,7 +36,7 @@ public static void GetReflectionInfo() b.Text += String.Format(" {0} ({1})\n", prop.Name, prop.PropertyType.Name); nProps++; } - if (nProps == 0) b.Text += " None\n"; + if (nProps == 0) b.Text += " None\n"; // Get methods. b.Text += "\nMethods:\n"; @@ -45,7 +45,7 @@ public static void GetReflectionInfo() foreach (var method in methods) { if (method.IsSpecialName) continue; - b.Text += String.Format(" {0}({1}) ({2})\n", method.Name, + b.Text += String.Format(" {0}({1}) ({2})\n", method.Name, GetSignature(method), method.ReturnType.Name); nMethods++; } @@ -72,8 +72,8 @@ namespace Windows.UI.Xaml.Controls internal class TextBlock { private String s; - - public String Text + + public String Text { get { return s; } set { s = value; } @@ -81,7 +81,7 @@ public String Text } } -public class App +public class App { public static void Main() { diff --git a/samples/snippets/csharp/VS_Snippets_CLR/projectn_reflection/cs/makegenerictype1.cs b/samples/snippets/csharp/VS_Snippets_CLR/projectn_reflection/cs/makegenerictype1.cs index 156588817577a..f9abae2bd593b 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/projectn_reflection/cs/makegenerictype1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/projectn_reflection/cs/makegenerictype1.cs @@ -24,7 +24,7 @@ public static void GetGenericInfo() Type generic1 = typeof(Dictionary<,>); DisplayGenericType(generic1); - // Get the type that represents a constructed generic type and its + // Get the type that represents a constructed generic type and its // generic type definition. Dictionary d1 = new Dictionary(); Type constructed1 = d1.GetType(); @@ -50,8 +50,8 @@ public static void GetGenericInfo() b.Text += String.Format(" Are the generic definitions equal? {0}\n", (generic1 == constructed2.GetGenericTypeDefinition())); - // Demonstrate the DisplayGenericType and - // DisplayGenericParameter methods with the Test class + // Demonstrate the DisplayGenericType and + // DisplayGenericParameter methods with the Test class // defined above. This shows base, interface, and special // constraints. DisplayGenericType(typeof(TestGeneric<>)); @@ -106,8 +106,8 @@ public TestArgument() internal class TextBlock { private String s; - - public String Text + + public String Text { get { return s; } set { s = value; } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/projectn_reflection/cs/method1.cs b/samples/snippets/csharp/VS_Snippets_CLR/projectn_reflection/cs/method1.cs index d0b7aefff5921..98366795524a2 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/projectn_reflection/cs/method1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/projectn_reflection/cs/method1.cs @@ -47,21 +47,21 @@ public void Execute() f = "C"; long lng = Int64.MaxValue; - outputBlock.Text += String.Format("'{0}'\n", + outputBlock.Text += String.Format("'{0}'\n", Stringify.ConvertToString(new object[] { lng, f })); - outputBlock.Text += String.Format("'{0}'\n", + outputBlock.Text += String.Format("'{0}'\n", Stringify.ConvertToString(new object[] { lng, "N1", fr })); Person p = new Person(); - outputBlock.Text += String.Format("'{0}'\n", + outputBlock.Text += String.Format("'{0}'\n", Stringify.ConvertToString(new object[] { p })); DateTime date = DateTime.Now; - outputBlock.Text += String.Format("'{0}'\n", + outputBlock.Text += String.Format("'{0}'\n", Stringify.ConvertToString(new object[] { date, "F" })); - outputBlock.Text += String.Format("'{0}'\n", + outputBlock.Text += String.Format("'{0}'\n", Stringify.ConvertToString(new object[] { date, "F", fr })); } } @@ -89,7 +89,7 @@ public static string ConvertToString(Object[] obj) string retval = ""; - // Parameters indicate either a format specifier, numeric base, or format provider, + // Parameters indicate either a format specifier, numeric base, or format provider, // or a format specifier with an IFormatProvider. // A string as the first parameter indicates a format specifier. @@ -105,7 +105,7 @@ public static string ConvertToString(Object[] obj) MethodInfo m = t.GetRuntimeMethod("ToString", new Type[] { typeof(String), obj[2].GetType() }); retval = m.Invoke(obj[0], new object[] { obj[1], obj[2] }).ToString(); } - } + } else if (obj[1] is IFormatProvider) { Type t = obj[0].GetType(); @@ -140,8 +140,8 @@ static MainPage() internal class TextBlock { private String s; - - public String Text + + public String Text { get { return s; } set { s = value; } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/projectn_reflection/cs/property1.cs b/samples/snippets/csharp/VS_Snippets_CLR/projectn_reflection/cs/property1.cs index 79cfad622bacc..6e8dda282020a 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/projectn_reflection/cs/property1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/projectn_reflection/cs/property1.cs @@ -18,8 +18,8 @@ static MainPage() internal class TextBlock { private String s; - - public String Text + + public String Text { get { return s; } set { s = value; } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/projectn_reflection/cs/propertyinfo1.cs b/samples/snippets/csharp/VS_Snippets_CLR/projectn_reflection/cs/propertyinfo1.cs index 6ad77c121142e..104f9ee7cb82c 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/projectn_reflection/cs/propertyinfo1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/projectn_reflection/cs/propertyinfo1.cs @@ -40,11 +40,11 @@ public void Example() } // The example displays the following output: // Character at position 6: g - // + // // The complete string: // a b c d e f g h i j k l m n o p q r s t u v w x y z - // - + // + public string Show() { return b.Text; @@ -54,8 +54,8 @@ public string Show() internal class TextBlock { private String s; - - public String Text + + public String Text { get { return s; } set { s = value; } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/projectn_reflection/cs/subtypes.cs b/samples/snippets/csharp/VS_Snippets_CLR/projectn_reflection/cs/subtypes.cs index de60a46e612db..a73256f3261d5 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/projectn_reflection/cs/subtypes.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/projectn_reflection/cs/subtypes.cs @@ -61,7 +61,7 @@ public class BaseClass { public BaseClass() { } - + public override string ToString() { return String.Format("{0} Version {1}", this.GetType().Name, Version); @@ -79,7 +79,7 @@ public override double Version { get { return 1.1; }} public override string ToString() - { + { return String.Format("{0} Version {1}", this.GetType().Name, Version); } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.language.alternation/cs/alternation1.cs b/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.language.alternation/cs/alternation1.cs index 46b0d03a2c033..9a23f6bb23e78 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.language.alternation/cs/alternation1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.language.alternation/cs/alternation1.cs @@ -10,21 +10,21 @@ public static void Main() string pattern1 = @"\bgr[ae]y\b"; // Regular expression using either/or. string pattern2 = @"\bgr(a|e)y\b"; - + string input = "The gray wolf blended in among the grey rocks."; foreach (Match match in Regex.Matches(input, pattern1)) - Console.WriteLine("'{0}' found at position {1}", + Console.WriteLine("'{0}' found at position {1}", match.Value, match.Index); Console.WriteLine(); foreach (Match match in Regex.Matches(input, pattern2)) - Console.WriteLine("'{0}' found at position {1}", + Console.WriteLine("'{0}' found at position {1}", match.Value, match.Index); } } // The example displays the following output: // 'gray' found at position 4 // 'grey' found at position 35 -// +// // 'gray' found at position 4 -// 'grey' found at position 35 +// 'grey' found at position 35 // diff --git a/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.language.backreferences/cs/backreference1.cs b/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.language.backreferences/cs/backreference1.cs index 159d439d77de2..03629f96f4031 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.language.backreferences/cs/backreference1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.language.backreferences/cs/backreference1.cs @@ -9,7 +9,7 @@ public static void Main() string pattern = @"(\w)\1"; string input = "trellis llama webbing dresser swagger"; foreach (Match match in Regex.Matches(input, pattern)) - Console.WriteLine("Found '{0}' at position {1}.", + Console.WriteLine("Found '{0}' at position {1}.", match.Value, match.Index); } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.language.backreferences/cs/backreference2.cs b/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.language.backreferences/cs/backreference2.cs index 7ba58583ec960..b3a9c6b8cf69c 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.language.backreferences/cs/backreference2.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.language.backreferences/cs/backreference2.cs @@ -9,7 +9,7 @@ public static void Main() string pattern = @"(?\w)\k"; string input = "trellis llama webbing dresser swagger"; foreach (Match match in Regex.Matches(input, pattern)) - Console.WriteLine("Found '{0}' at position {1}.", + Console.WriteLine("Found '{0}' at position {1}.", match.Value, match.Index); } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.language.backreferences/cs/backreference3.cs b/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.language.backreferences/cs/backreference3.cs index da0ca0d0ae49c..177fe6d8c73f7 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.language.backreferences/cs/backreference3.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.language.backreferences/cs/backreference3.cs @@ -9,7 +9,7 @@ public static void Main() string pattern = @"(?<2>\w)\k<2>"; string input = "trellis llama webbing dresser swagger"; foreach (Match match in Regex.Matches(input, pattern)) - Console.WriteLine("Found '{0}' at position {1}.", + Console.WriteLine("Found '{0}' at position {1}.", match.Value, match.Index); } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.language.backreferences/cs/backreference5.cs b/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.language.backreferences/cs/backreference5.cs index 067d4a2d7b44b..46488e51001cc 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.language.backreferences/cs/backreference5.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.language.backreferences/cs/backreference5.cs @@ -19,7 +19,7 @@ public static void Main() for (int ctr = 1; ctr <= match.Groups.Count - 1; ctr++) { if (match.Groups[ctr].Success) - Console.WriteLine("Group {0}: {1}", + Console.WriteLine("Group {0}: {1}", ctr, match.Groups[ctr].Value); else Console.WriteLine("Group {0}: ", ctr); @@ -27,7 +27,7 @@ public static void Main() } } Console.WriteLine(); - } + } } } // The example displays the following output: @@ -35,7 +35,7 @@ public static void Main() // Group 1: AA // Group 2: 22 // Group 3: ZZ -// +// // Match in AABB: AABB // Group 1: AA // Group 2: diff --git a/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.language.backreferences/cs/backreference6.cs b/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.language.backreferences/cs/backreference6.cs index 2d53fcb5be012..065f9aafd099c 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.language.backreferences/cs/backreference6.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.language.backreferences/cs/backreference6.cs @@ -5,7 +5,7 @@ public class Example { public static void Main() { - Console.WriteLine(Regex.IsMatch("aa", @"(?\w)\k<1>")); + Console.WriteLine(Regex.IsMatch("aa", @"(?\w)\k<1>")); // Displays "True". } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.language.backreferences/cs/backreference7.cs b/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.language.backreferences/cs/backreference7.cs index 6369c8fe89b88..7bd4b67725f77 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.language.backreferences/cs/backreference7.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.language.backreferences/cs/backreference7.cs @@ -5,7 +5,7 @@ public class Example { public static void Main() { - Console.WriteLine(Regex.IsMatch("aa", @"(?<2>\w)\k<1>")); + Console.WriteLine(Regex.IsMatch("aa", @"(?<2>\w)\k<1>")); // Throws an ArgumentException. } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.language.escapes/cs/escape1.cs b/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.language.escapes/cs/escape1.cs index 01b20df39a88c..5bcee7fa08b8a 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.language.escapes/cs/escape1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.language.escapes/cs/escape1.cs @@ -7,25 +7,25 @@ public class Example public static void Main() { string delimited = @"\G(.+)[\t\u007c](.+)\r?\n"; - string input = "Mumbai, India|13,922,125\t\n" + - "Shanghai, China\t13,831,900\n" + - "Karachi, Pakistan|12,991,000\n" + - "Delhi, India\t12,259,230\n" + + string input = "Mumbai, India|13,922,125\t\n" + + "Shanghai, China\t13,831,900\n" + + "Karachi, Pakistan|12,991,000\n" + + "Delhi, India\t12,259,230\n" + "Istanbul, Turkey|11,372,613\n"; Console.WriteLine("Population of the World's Largest Cities, 2009"); Console.WriteLine(); Console.WriteLine("{0,-20} {1,10}", "City", "Population"); Console.WriteLine(); foreach (Match match in Regex.Matches(input, delimited)) - Console.WriteLine("{0,-20} {1,10}", match.Groups[1].Value, + Console.WriteLine("{0,-20} {1,10}", match.Groups[1].Value, match.Groups[2].Value); } } // The example displays the following output: // Population of the World's Largest Cities, 2009 -// +// // City Population -// +// // Mumbai, India 13,922,125 // Shanghai, China 13,831,900 // Karachi, Pakistan 12,991,000 diff --git a/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.language.grouping/cs/grouping1.cs b/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.language.grouping/cs/grouping1.cs index a601ab6b947d2..1a62efad0179c 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.language.grouping/cs/grouping1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.language.grouping/cs/grouping1.cs @@ -9,7 +9,7 @@ public static void Main() string pattern = @"(\w+)\s(\1)"; string input = "He said that that was the the correct answer."; foreach (Match match in Regex.Matches(input, pattern, RegexOptions.IgnoreCase)) - Console.WriteLine("Duplicate '{0}' found at positions {1} and {2}.", + Console.WriteLine("Duplicate '{0}' found at positions {1} and {2}.", match.Groups[1].Value, match.Groups[1].Index, match.Groups[2].Index); } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.language.grouping/cs/grouping2.cs b/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.language.grouping/cs/grouping2.cs index 76e50c41c31c0..7f6266a94be94 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.language.grouping/cs/grouping2.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.language.grouping/cs/grouping2.cs @@ -9,8 +9,8 @@ public static void Main() string pattern = @"(?\w+)\s\k\W(?\w+)"; string input = "He said that that was the the correct answer."; foreach (Match match in Regex.Matches(input, pattern, RegexOptions.IgnoreCase)) - Console.WriteLine("A duplicate '{0}' at position {1} is followed by '{2}'.", - match.Groups["duplicateWord"].Value, match.Groups["duplicateWord"].Index, + Console.WriteLine("A duplicate '{0}' at position {1} is followed by '{2}'.", + match.Groups["duplicateWord"].Value, match.Groups["duplicateWord"].Index, match.Groups["nextWord"].Value); } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.language.grouping/cs/grouping3.cs b/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.language.grouping/cs/grouping3.cs index 5887241c3e867..1d67acb73170c 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.language.grouping/cs/grouping3.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.language.grouping/cs/grouping3.cs @@ -4,10 +4,10 @@ class Example { - public static void Main() + public static void Main() { string pattern = "^[^<>]*" + - "(" + + "(" + "((?'Open'<)[^<>]*)+" + "((?'Close-Open'>)[^<>]*)+" + ")*" + @@ -25,7 +25,7 @@ public static void Main() grpCtr++; int capCtr = 0; foreach (Capture cap in grp.Captures) - { + { Console.WriteLine(" Capture {0}: {1}", capCtr, cap.Value); capCtr++; } @@ -34,7 +34,7 @@ public static void Main() else { Console.WriteLine("Match failed."); - } + } } } // The example displays the following output: diff --git a/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.language.grouping/cs/lookahead1.cs b/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.language.grouping/cs/lookahead1.cs index b26aa04429b21..c63ac730e2068 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.language.grouping/cs/lookahead1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.language.grouping/cs/lookahead1.cs @@ -7,9 +7,9 @@ public class Example public static void Main() { string pattern = @"\b\w+(?=\sis\b)"; - string[] inputs = { "The dog is a Malamute.", - "The island has beautiful birds.", - "The pitch missed home plate.", + string[] inputs = { "The dog is a Malamute.", + "The island has beautiful birds.", + "The pitch missed home plate.", "Sunday is a weekend day." }; foreach (string input in inputs) @@ -18,7 +18,7 @@ public static void Main() if (match.Success) Console.WriteLine("'{0}' precedes 'is'.", match.Value); else - Console.WriteLine("'{0}' does not match the pattern.", input); + Console.WriteLine("'{0}' does not match the pattern.", input); } } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.language.grouping/cs/lookbehind1.cs b/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.language.grouping/cs/lookbehind1.cs index f799019a5b1fa..66de9f8471e07 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.language.grouping/cs/lookbehind1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.language.grouping/cs/lookbehind1.cs @@ -8,7 +8,7 @@ public static void Main() { string input = "2010 1999 1861 2140 2009"; string pattern = @"(?<=\b20)\d{2}\b"; - + foreach (Match match in Regex.Matches(input, pattern)) Console.WriteLine(match.Value); } diff --git a/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.language.grouping/cs/negativelookbehind1.cs b/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.language.grouping/cs/negativelookbehind1.cs index 3adc5d382d944..1657ef6bbcf31 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.language.grouping/cs/negativelookbehind1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.language.grouping/cs/negativelookbehind1.cs @@ -6,19 +6,19 @@ public class Example { public static void Main() { - string[] dates = { "Monday February 1, 2010", - "Wednesday February 3, 2010", - "Saturday February 6, 2010", - "Sunday February 7, 2010", + string[] dates = { "Monday February 1, 2010", + "Wednesday February 3, 2010", + "Saturday February 6, 2010", + "Sunday February 7, 2010", "Monday, February 8, 2010" }; string pattern = @"(?(\w)\1+).\b"; - + foreach (string input in inputs) { Match match1 = Regex.Match(input, back); @@ -21,7 +21,7 @@ public static void Main() Console.WriteLine(match1.Value); else Console.WriteLine("No match"); - + Console.Write(" Nonbacktracking: "); if (match2.Success) Console.WriteLine(match2.Value); diff --git a/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.language.miscellaneous/cs/miscellaneous1.cs b/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.language.miscellaneous/cs/miscellaneous1.cs index d855a92f07c2c..572efbeefbfe0 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.language.miscellaneous/cs/miscellaneous1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.language.miscellaneous/cs/miscellaneous1.cs @@ -6,28 +6,28 @@ public class Example { public static void Main() { - string pattern; + string pattern; string input = "double dare double Double a Drooling dog The Dreaded Deep"; - + pattern = @"\b(D\w+)\s(d\w+)\b"; // Match pattern using default options. foreach (Match match in Regex.Matches(input, pattern)) { Console.WriteLine(match.Value); if (match.Groups.Count > 1) - for (int ctr = 1; ctr < match.Groups.Count; ctr++) + for (int ctr = 1; ctr < match.Groups.Count; ctr++) Console.WriteLine(" Group {0}: {1}", ctr, match.Groups[ctr].Value); } Console.WriteLine(); - + // Change regular expression pattern to include options. pattern = @"\b(D\w+)(?ixn) \s (d\w+) \b"; - // Match new pattern with options. + // Match new pattern with options. foreach (Match match in Regex.Matches(input, pattern)) { Console.WriteLine(match.Value); if (match.Groups.Count > 1) - for (int ctr = 1; ctr < match.Groups.Count; ctr++) + for (int ctr = 1; ctr < match.Groups.Count; ctr++) Console.WriteLine(" Group {0}: '{1}'", ctr, match.Groups[ctr].Value); } } @@ -36,7 +36,7 @@ public static void Main() // Drooling dog // Group 1: Drooling // Group 2: dog -// +// // Drooling dog // Group 1: 'Drooling' // Dreaded Deep diff --git a/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.language.miscellaneous/cs/miscellaneous2.cs b/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.language.miscellaneous/cs/miscellaneous2.cs index 18184bf0c4696..c38e10e67da95 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.language.miscellaneous/cs/miscellaneous2.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.language.miscellaneous/cs/miscellaneous2.cs @@ -17,7 +17,7 @@ public static void Main() Console.WriteLine(match.Value); if (match.Groups.Count > 1) { - for (int ctr = 1; ctr +// diff --git a/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.quantifiers.emptymatch/cs/emptymatch1.cs b/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.quantifiers.emptymatch/cs/emptymatch1.cs index efbaf47ab7804..ae6e0351189ce 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.quantifiers.emptymatch/cs/emptymatch1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.quantifiers.emptymatch/cs/emptymatch1.cs @@ -9,23 +9,23 @@ public static void Main() string pattern = "(a?)*"; string input = "aaabbb"; Match match = Regex.Match(input, pattern); - Console.WriteLine("Match: '{0}' at index {1}", + Console.WriteLine("Match: '{0}' at index {1}", match.Value, match.Index); if (match.Groups.Count > 1) { GroupCollection groups = match.Groups; for (int grpCtr = 1; grpCtr <= groups.Count - 1; grpCtr++) { - Console.WriteLine(" Group {0}: '{1}' at index {2}", - grpCtr, + Console.WriteLine(" Group {0}: '{1}' at index {2}", + grpCtr, groups[grpCtr].Value, groups[grpCtr].Index); int captureCtr = 0; foreach (Capture capture in groups[grpCtr].Captures) { captureCtr++; - Console.WriteLine(" Capture {0}: '{1}' at index {2}", + Console.WriteLine(" Capture {0}: '{1}' at index {2}", captureCtr, capture.Value, capture.Index); } - } - } + } + } } } // The example displays the following output: diff --git a/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.quantifiers.emptymatch/cs/emptymatch4.cs b/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.quantifiers.emptymatch/cs/emptymatch4.cs index d007927277afd..f3de37b51c826 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.quantifiers.emptymatch/cs/emptymatch4.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR/regularexpressions.quantifiers.emptymatch/cs/emptymatch4.cs @@ -7,26 +7,26 @@ public class Example public static void Main() { string pattern, input; - + pattern = @"(a\1|(?(1)\1)){0,2}"; - input = "aaabbb"; + input = "aaabbb"; Console.WriteLine("Regex pattern: {0}", pattern); Match match = Regex.Match(input, pattern); - Console.WriteLine("Match: '{0}' at position {1}.", + Console.WriteLine("Match: '{0}' at position {1}.", match.Value, match.Index); if (match.Groups.Count > 1) { for (int groupCtr = 1; groupCtr <= match.Groups.Count - 1; groupCtr++) { - Group group = match.Groups[groupCtr]; - Console.WriteLine(" Group: {0}: '{1}' at position {2}.", + Group group = match.Groups[groupCtr]; + Console.WriteLine(" Group: {0}: '{1}' at position {2}.", groupCtr, group.Value, group.Index); int captureCtr = 0; foreach (Capture capture in group.Captures) { captureCtr++; - Console.WriteLine(" Capture: {0}: '{1}' at position {2}.", + Console.WriteLine(" Capture: {0}: '{1}' at position {2}.", captureCtr, capture.Value, capture.Index); - } + } } } Console.WriteLine(); @@ -34,20 +34,20 @@ public static void Main() pattern = @"(a\1|(?(1)\1)){2}"; Console.WriteLine("Regex pattern: {0}", pattern); match = Regex.Match(input, pattern); - Console.WriteLine("Matched '{0}' at position {1}.", + Console.WriteLine("Matched '{0}' at position {1}.", match.Value, match.Index); if (match.Groups.Count > 1) { for (int groupCtr = 1; groupCtr <= match.Groups.Count - 1; groupCtr++) { - Group group = match.Groups[groupCtr]; - Console.WriteLine(" Group: {0}: '{1}' at position {2}.", + Group group = match.Groups[groupCtr]; + Console.WriteLine(" Group: {0}: '{1}' at position {2}.", groupCtr, group.Value, group.Index); int captureCtr = 0; foreach (Capture capture in group.Captures) { captureCtr++; - Console.WriteLine(" Capture: {0}: '{1}' at position {2}.", + Console.WriteLine(" Capture: {0}: '{1}' at position {2}.", captureCtr, capture.Value, capture.Index); - } + } } } } @@ -57,7 +57,7 @@ public static void Main() // Match: '' at position 0. // Group: 1: '' at position 0. // Capture: 1: '' at position 0. -// +// // Regex pattern: (a\1|(?(1)\1)){2} // Matched 'a' at position 0. // Group: 1: 'a' at position 0. diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/System.Globalization.CultureInfo/cs/Change1.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/System.Globalization.CultureInfo/cs/Change1.cs index d19ce9923e9d0..5b09b7a275071 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/System.Globalization.CultureInfo/cs/Change1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/System.Globalization.CultureInfo/cs/Change1.cs @@ -11,12 +11,12 @@ public static void Main() CultureInfo newCulture; if (current.Name.Equals("fr-FR")) newCulture = new CultureInfo("fr-LU"); - else + else newCulture = new CultureInfo("fr-FR"); - + CultureInfo.CurrentCulture = newCulture; - Console.WriteLine("The current culture is now {0}", - CultureInfo.CurrentCulture.Name); + Console.WriteLine("The current culture is now {0}", + CultureInfo.CurrentCulture.Name); } } // The example displays output like the following: diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/System.Globalization.CultureInfo/cs/ChangeUI1.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/System.Globalization.CultureInfo/cs/ChangeUI1.cs index 93e4b3def7f37..19c89853e7eef 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/System.Globalization.CultureInfo/cs/ChangeUI1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/System.Globalization.CultureInfo/cs/ChangeUI1.cs @@ -11,12 +11,12 @@ public static void Main() CultureInfo newUICulture; if (current.Name.Equals("sl-SI")) newUICulture = new CultureInfo("hr-HR"); - else + else newUICulture = new CultureInfo("sl-SI"); - + CultureInfo.CurrentUICulture = newUICulture; - Console.WriteLine("The current UI culture is now {0}", - CultureInfo.CurrentUICulture.Name); + Console.WriteLine("The current UI culture is now {0}", + CultureInfo.CurrentUICulture.Name); } } // The example displays output like the following: diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/System.Globalization.CultureInfo/cs/GetCultures1.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/System.Globalization.CultureInfo/cs/GetCultures1.cs index 24e4b209c9a3a..107864c7d062b 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/System.Globalization.CultureInfo/cs/GetCultures1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/System.Globalization.CultureInfo/cs/GetCultures1.cs @@ -8,25 +8,25 @@ public static void Main() { // Get all custom cultures. CultureInfo[] custom = CultureInfo.GetCultures(CultureTypes.UserCustomCulture); - if (custom.Length == 0) { + if (custom.Length == 0) { Console.WriteLine("There are no user-defined custom cultures."); } else { Console.WriteLine("Custom cultures:"); - foreach (var culture in custom) - Console.WriteLine(" {0} -- {1}", culture.Name, culture.DisplayName); + foreach (var culture in custom) + Console.WriteLine(" {0} -- {1}", culture.Name, culture.DisplayName); } Console.WriteLine(); - + // Get all replacement cultures. CultureInfo[] replacements = CultureInfo.GetCultures(CultureTypes.ReplacementCultures); - if (replacements.Length == 0) { + if (replacements.Length == 0) { Console.WriteLine("There are no replacement cultures."); - } + } else { Console.WriteLine("Replacement cultures:"); - foreach (var culture in replacements) - Console.WriteLine(" {0} -- {1}", culture.Name, culture.DisplayName); + foreach (var culture in replacements) + Console.WriteLine(" {0} -- {1}", culture.Name, culture.DisplayName); } Console.WriteLine(); } @@ -35,6 +35,6 @@ public static void Main() // Custom cultures: // x-en-US-sample -- English (United States) // fj-FJ -- Boumaa Fijian (Viti) -// +// // There are no replacement cultures. // diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/System.Runtime.BypassNGenAttribute/cs/Optout1.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/System.Runtime.BypassNGenAttribute/cs/Optout1.cs index 506cd15f29c28..3a68eeec3de78 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/System.Runtime.BypassNGenAttribute/cs/Optout1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/System.Runtime.BypassNGenAttribute/cs/Optout1.cs @@ -14,11 +14,11 @@ public void ToJITCompile() // namespace System.Runtime { - [AttributeUsage(AttributeTargets.Method | - AttributeTargets.Constructor | + [AttributeUsage(AttributeTargets.Method | + AttributeTargets.Constructor | AttributeTargets.Property)] - public class BypassNGenAttribute : Attribute + public class BypassNGenAttribute : Attribute { - } + } } // diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/System.Threading.Thread/cs/BackgroundEx1.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/System.Threading.Thread/cs/BackgroundEx1.cs index d591d559c6a40..331e59a5e8f0e 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/System.Threading.Thread/cs/BackgroundEx1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/System.Threading.Thread/cs/BackgroundEx1.cs @@ -11,25 +11,25 @@ public static void Main() th.IsBackground = true; th.Start(); Thread.Sleep(1000); - Console.WriteLine("Main thread ({0}) exiting...", - Thread.CurrentThread.ManagedThreadId); + Console.WriteLine("Main thread ({0}) exiting...", + Thread.CurrentThread.ManagedThreadId); } - + private static void ExecuteInForeground() { DateTime start = DateTime.Now; var sw = Stopwatch.StartNew(); - Console.WriteLine("Thread {0}: {1}, Priority {2}", + Console.WriteLine("Thread {0}: {1}, Priority {2}", Thread.CurrentThread.ManagedThreadId, Thread.CurrentThread.ThreadState, Thread.CurrentThread.Priority); - do { - Console.WriteLine("Thread {0}: Elapsed {1:N2} seconds", + do { + Console.WriteLine("Thread {0}: Elapsed {1:N2} seconds", Thread.CurrentThread.ManagedThreadId, sw.ElapsedMilliseconds / 1000.0); Thread.Sleep(500); } while (sw.ElapsedMilliseconds <= 5000); - sw.Stop(); + sw.Stop(); } } // The example displays output like the following: diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/System.Threading.Thread/cs/Instance1.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/System.Threading.Thread/cs/Instance1.cs index ca534044a6dcc..71d9b0d236377 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/System.Threading.Thread/cs/Instance1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/System.Threading.Thread/cs/Instance1.cs @@ -5,7 +5,7 @@ public class Example { static Object obj = new Object(); - + public static void Main() { ThreadPool.QueueUserWorkItem(ShowThreadInformation); @@ -15,9 +15,9 @@ public static void Main() th2.IsBackground = true; th2.Start(); Thread.Sleep(500); - ShowThreadInformation(null); + ShowThreadInformation(null); } - + private static void ShowThreadInformation(Object state) { lock (obj) { @@ -29,7 +29,7 @@ private static void ShowThreadInformation(Object state) Console.WriteLine(" Culture: {0}", th.CurrentCulture.Name); Console.WriteLine(" UI culture: {0}", th.CurrentUICulture.Name); Console.WriteLine(); - } + } } } // The example displays output like the following: @@ -39,21 +39,21 @@ private static void ShowThreadInformation(Object state) // Priority: Normal // Culture: en-US // UI culture: en-US -// +// // Managed thread #3: // Background thread: True // Thread pool thread: True // Priority: Normal // Culture: en-US // UI culture: en-US -// +// // Managed thread #4: // Background thread: False // Thread pool thread: False // Priority: Normal // Culture: en-US // UI culture: en-US -// +// // Managed thread #1: // Background thread: False // Thread pool thread: False diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/System.Threading.Thread/cs/ThreadStart1.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/System.Threading.Thread/cs/ThreadStart1.cs index f9981872a51fc..3e118b6361ab1 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/System.Threading.Thread/cs/ThreadStart1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/System.Threading.Thread/cs/ThreadStart1.cs @@ -10,25 +10,25 @@ public static void Main() var th = new Thread(ExecuteInForeground); th.Start(); Thread.Sleep(1000); - Console.WriteLine("Main thread ({0}) exiting...", - Thread.CurrentThread.ManagedThreadId); + Console.WriteLine("Main thread ({0}) exiting...", + Thread.CurrentThread.ManagedThreadId); } - + private static void ExecuteInForeground() { DateTime start = DateTime.Now; var sw = Stopwatch.StartNew(); - Console.WriteLine("Thread {0}: {1}, Priority {2}", + Console.WriteLine("Thread {0}: {1}, Priority {2}", Thread.CurrentThread.ManagedThreadId, Thread.CurrentThread.ThreadState, Thread.CurrentThread.Priority); - do { - Console.WriteLine("Thread {0}: Elapsed {1:N2} seconds", + do { + Console.WriteLine("Thread {0}: Elapsed {1:N2} seconds", Thread.CurrentThread.ManagedThreadId, sw.ElapsedMilliseconds / 1000.0); Thread.Sleep(500); } while (sw.ElapsedMilliseconds <= 5000); - sw.Stop(); + sw.Stop(); } } // The example displays output like the following: diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/System.Threading.Thread/cs/ThreadStart2.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/System.Threading.Thread/cs/ThreadStart2.cs index c3531baa9e210..db69b7982ce23 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/System.Threading.Thread/cs/ThreadStart2.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/System.Threading.Thread/cs/ThreadStart2.cs @@ -10,10 +10,10 @@ public static void Main() var th = new Thread(ExecuteInForeground); th.Start(4500); Thread.Sleep(1000); - Console.WriteLine("Main thread ({0}) exiting...", - Thread.CurrentThread.ManagedThreadId); + Console.WriteLine("Main thread ({0}) exiting...", + Thread.CurrentThread.ManagedThreadId); } - + private static void ExecuteInForeground(Object obj) { int interval; @@ -25,17 +25,17 @@ private static void ExecuteInForeground(Object obj) } DateTime start = DateTime.Now; var sw = Stopwatch.StartNew(); - Console.WriteLine("Thread {0}: {1}, Priority {2}", + Console.WriteLine("Thread {0}: {1}, Priority {2}", Thread.CurrentThread.ManagedThreadId, Thread.CurrentThread.ThreadState, Thread.CurrentThread.Priority); - do { - Console.WriteLine("Thread {0}: Elapsed {1:N2} seconds", + do { + Console.WriteLine("Thread {0}: Elapsed {1:N2} seconds", Thread.CurrentThread.ManagedThreadId, sw.ElapsedMilliseconds / 1000.0); Thread.Sleep(500); } while (sw.ElapsedMilliseconds <= interval); - sw.Stop(); + sw.Stop(); } } // The example displays output like the following: diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.DateTime.Conceptual.Formatting/cs/StandardFormats1.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.DateTime.Conceptual.Formatting/cs/StandardFormats1.cs index 49cf905f97e61..7ac93a167f447 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.DateTime.Conceptual.Formatting/cs/StandardFormats1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.DateTime.Conceptual.Formatting/cs/StandardFormats1.cs @@ -10,25 +10,25 @@ public static void Main() UseSpecificFormattingInfo(); } - private static void ShowDefaultFormat() - { + private static void ShowDefaultFormat() + { // // Display using current (en-us) culture's short date format DateTime thisDate = new DateTime(2008, 3, 15); Console.WriteLine(thisDate.ToString("d")); // Displays 3/15/2008 // } - + private static void UseSpecificCulture() { // // Display using pt-BR culture's short date format DateTime thisDate = new DateTime(2008, 3, 15); - CultureInfo culture = new CultureInfo("pt-BR"); + CultureInfo culture = new CultureInfo("pt-BR"); Console.WriteLine(thisDate.ToString("d", culture)); // Displays 15/3/2008 // } - + private static void UseSpecificFormattingInfo() { // diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.DateTimeOffset.Conceptual.Conversions/cs/Conversions.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.DateTimeOffset.Conceptual.Conversions/cs/Conversions.cs index 03677d0f6af7b..bd5888adca36a 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.DateTimeOffset.Conceptual.Conversions/cs/Conversions.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.DateTimeOffset.Conceptual.Conversions/cs/Conversions.cs @@ -40,22 +40,22 @@ private static void ConvertUsingDateTime() DateTime baseTime = new DateTime(2008, 6, 19, 7, 0, 0); DateTimeOffset sourceTime; DateTime targetTime; - + // Convert UTC to DateTime value sourceTime = new DateTimeOffset(baseTime, TimeSpan.Zero); targetTime = sourceTime.DateTime; - Console.WriteLine("{0} converts to {1} {2}", - sourceTime, - targetTime, + Console.WriteLine("{0} converts to {1} {2}", + sourceTime, + targetTime, targetTime.Kind.ToString()); // Convert local time to DateTime value - sourceTime = new DateTimeOffset(baseTime, + sourceTime = new DateTimeOffset(baseTime, TimeZoneInfo.Local.GetUtcOffset(baseTime)); targetTime = sourceTime.DateTime; - Console.WriteLine("{0} converts to {1} {2}", - sourceTime, - targetTime, + Console.WriteLine("{0} converts to {1} {2}", + sourceTime, + targetTime, targetTime.Kind.ToString()); // Convert Central Standard Time to a DateTime value @@ -64,54 +64,54 @@ private static void ConvertUsingDateTime() TimeSpan offset = TimeZoneInfo.FindSystemTimeZoneById("Central Standard Time").GetUtcOffset(baseTime); sourceTime = new DateTimeOffset(baseTime, offset); targetTime = sourceTime.DateTime; - Console.WriteLine("{0} converts to {1} {2}", - sourceTime, - targetTime, + Console.WriteLine("{0} converts to {1} {2}", + sourceTime, + targetTime, targetTime.Kind.ToString()); } catch (TimeZoneNotFoundException) { Console.WriteLine("Unable to create DateTimeOffset based on U.S. Central Standard Time."); - } + } // This example displays the following output to the console: // 6/19/2008 7:00:00 AM +00:00 converts to 6/19/2008 7:00:00 AM Unspecified // 6/19/2008 7:00:00 AM -07:00 converts to 6/19/2008 7:00:00 AM Unspecified - // 6/19/2008 7:00:00 AM -05:00 converts to 6/19/2008 7:00:00 AM Unspecified + // 6/19/2008 7:00:00 AM -05:00 converts to 6/19/2008 7:00:00 AM Unspecified // } - + private static void ConvertUtcTime() { // DateTimeOffset utcTime1 = new DateTimeOffset(2008, 6, 19, 7, 0, 0, TimeSpan.Zero); DateTime utcTime2 = utcTime1.UtcDateTime; - Console.WriteLine("{0} converted to {1} {2}", - utcTime1, - utcTime2, + Console.WriteLine("{0} converted to {1} {2}", + utcTime1, + utcTime2, utcTime2.Kind.ToString()); // The example displays the following output to the console: - // 6/19/2008 7:00:00 AM +00:00 converted to 6/19/2008 7:00:00 AM Utc + // 6/19/2008 7:00:00 AM +00:00 converted to 6/19/2008 7:00:00 AM Utc // } - + private static void ConvertLocalTime() { // DateTime sourceDate = new DateTime(2008, 6, 19, 7, 0, 0); - DateTimeOffset utcTime1 = new DateTimeOffset(sourceDate, + DateTimeOffset utcTime1 = new DateTimeOffset(sourceDate, TimeZoneInfo.Local.GetUtcOffset(sourceDate)); DateTime utcTime2 = utcTime1.DateTime; - if (utcTime1.Offset.Equals(TimeZoneInfo.Local.GetUtcOffset(utcTime1.DateTime))) + if (utcTime1.Offset.Equals(TimeZoneInfo.Local.GetUtcOffset(utcTime1.DateTime))) utcTime2 = DateTime.SpecifyKind(utcTime2, DateTimeKind.Local); - Console.WriteLine("{0} converted to {1} {2}", - utcTime1, - utcTime2, + Console.WriteLine("{0} converted to {1} {2}", + utcTime1, + utcTime2, utcTime2.Kind.ToString()); // The example displays the following output to the console: - // 6/19/2008 7:00:00 AM -07:00 converted to 6/19/2008 7:00:00 AM Local + // 6/19/2008 7:00:00 AM -07:00 converted to 6/19/2008 7:00:00 AM Local // - } + } // static DateTime ConvertFromDateTimeOffset(DateTimeOffset dateTime) @@ -121,40 +121,40 @@ static DateTime ConvertFromDateTimeOffset(DateTimeOffset dateTime) else if (dateTime.Offset.Equals(TimeZoneInfo.Local.GetUtcOffset(dateTime.DateTime))) return DateTime.SpecifyKind(dateTime.DateTime, DateTimeKind.Local); else - return dateTime.DateTime; + return dateTime.DateTime; } // - + private static void CallConversionFunction() { // DateTime timeComponent = new DateTime(2008, 6, 19, 7, 0, 0); - DateTime returnedDate; - + DateTime returnedDate; + // Convert UTC time DateTimeOffset utcTime = new DateTimeOffset(timeComponent, TimeSpan.Zero); - returnedDate = ConvertFromDateTimeOffset(utcTime); - Console.WriteLine("{0} converted to {1} {2}", - utcTime, - returnedDate, + returnedDate = ConvertFromDateTimeOffset(utcTime); + Console.WriteLine("{0} converted to {1} {2}", + utcTime, + returnedDate, returnedDate.Kind.ToString()); - + // Convert local time - DateTimeOffset localTime = new DateTimeOffset(timeComponent, - TimeZoneInfo.Local.GetUtcOffset(timeComponent)); - returnedDate = ConvertFromDateTimeOffset(localTime); - Console.WriteLine("{0} converted to {1} {2}", - localTime, - returnedDate, + DateTimeOffset localTime = new DateTimeOffset(timeComponent, + TimeZoneInfo.Local.GetUtcOffset(timeComponent)); + returnedDate = ConvertFromDateTimeOffset(localTime); + Console.WriteLine("{0} converted to {1} {2}", + localTime, + returnedDate, returnedDate.Kind.ToString()); // Convert Central Standard Time - DateTimeOffset cstTime = new DateTimeOffset(timeComponent, + DateTimeOffset cstTime = new DateTimeOffset(timeComponent, TimeZoneInfo.FindSystemTimeZoneById("Central Standard Time").GetUtcOffset(timeComponent)); returnedDate = ConvertFromDateTimeOffset(cstTime); - Console.WriteLine("{0} converted to {1} {2}", - cstTime, - returnedDate, + Console.WriteLine("{0} converted to {1} {2}", + cstTime, + returnedDate, returnedDate.Kind.ToString()); // The example displays the following output to the console: // 6/19/2008 7:00:00 AM +00:00 converted to 6/19/2008 7:00:00 AM Utc @@ -162,62 +162,62 @@ private static void CallConversionFunction() // 6/19/2008 7:00:00 AM -05:00 converted to 6/19/2008 7:00:00 AM Unspecified // } - + private static void ConvertUtcToDateTimeOffset() { // DateTime utcTime1 = new DateTime(2008, 6, 19, 7, 0, 0); utcTime1 = DateTime.SpecifyKind(utcTime1, DateTimeKind.Utc); DateTimeOffset utcTime2 = utcTime1; - Console.WriteLine("Converted {0} {1} to a DateTimeOffset value of {2}", - utcTime1, - utcTime1.Kind.ToString(), + Console.WriteLine("Converted {0} {1} to a DateTimeOffset value of {2}", + utcTime1, + utcTime1.Kind.ToString(), utcTime2); // This example displays the following output to the console: - // Converted 6/19/2008 7:00:00 AM Utc to a DateTimeOffset value of 6/19/2008 7:00:00 AM +00:00 - // + // Converted 6/19/2008 7:00:00 AM Utc to a DateTimeOffset value of 6/19/2008 7:00:00 AM +00:00 + // } - + private static void ConvertLocalToDateTimeOffset() { // DateTime localTime1 = new DateTime(2008, 6, 19, 7, 0, 0); localTime1 = DateTime.SpecifyKind(localTime1, DateTimeKind.Local); DateTimeOffset localTime2 = localTime1; - Console.WriteLine("Converted {0} {1} to a DateTimeOffset value of {2}", - localTime1, - localTime1.Kind.ToString(), + Console.WriteLine("Converted {0} {1} to a DateTimeOffset value of {2}", + localTime1, + localTime1.Kind.ToString(), localTime2); // This example displays the following output to the console: // Converted 6/19/2008 7:00:00 AM Local to a DateTimeOffset value of 6/19/2008 7:00:00 AM -07:00 - // + // } - + private static void ConvertUnspecifiedToDateTimeOffset1() { // DateTime time1 = new DateTime(2008, 6, 19, 7, 0, 0); // Kind is DateTimeKind.Unspecified DateTimeOffset time2 = time1; - Console.WriteLine("Converted {0} {1} to a DateTimeOffset value of {2}", - time1, - time1.Kind.ToString(), + Console.WriteLine("Converted {0} {1} to a DateTimeOffset value of {2}", + time1, + time1.Kind.ToString(), time2); // This example displays the following output to the console: // Converted 6/19/2008 7:00:00 AM Unspecified to a DateTimeOffset value of 6/19/2008 7:00:00 AM -07:00 // } - + private static void ConvertUnspecifiedToDateTimeOffset2() { // DateTime time1 = new DateTime(2008, 6, 19, 7, 0, 0); // Kind is DateTimeKind.Unspecified try { - DateTimeOffset time2 = new DateTimeOffset(time1, - TimeZoneInfo.FindSystemTimeZoneById("Central Standard Time").GetUtcOffset(time1)); - Console.WriteLine("Converted {0} {1} to a DateTime value of {2}", - time1, - time1.Kind.ToString(), + DateTimeOffset time2 = new DateTimeOffset(time1, + TimeZoneInfo.FindSystemTimeZoneById("Central Standard Time").GetUtcOffset(time1)); + Console.WriteLine("Converted {0} {1} to a DateTime value of {2}", + time1, + time1.Kind.ToString(), time2); } // Handle exception if time zone is not defined in registry @@ -234,16 +234,16 @@ private static void ConvertUsingLocalTimeProperty1() { // DateTime sourceDate = new DateTime(2008, 6, 19, 7, 0, 0); - DateTimeOffset localTime1 = new DateTimeOffset(sourceDate, + DateTimeOffset localTime1 = new DateTimeOffset(sourceDate, TimeZoneInfo.Local.GetUtcOffset(sourceDate)); DateTime localTime2 = localTime1.LocalDateTime; - Console.WriteLine("{0} converted to {1} {2}", - localTime1, - localTime2, + Console.WriteLine("{0} converted to {1} {2}", + localTime1, + localTime2, localTime2.Kind.ToString()); // The example displays the following output to the console: - // 6/19/2008 7:00:00 AM -07:00 converted to 6/19/2008 7:00:00 AM Local + // 6/19/2008 7:00:00 AM -07:00 converted to 6/19/2008 7:00:00 AM Local // } @@ -252,23 +252,23 @@ private static void ConvertUsingLocalTimeProperty2() // DateTimeOffset originalDate; DateTime localDate; - + // Convert time originating in a different time zone - originalDate = new DateTimeOffset(2008, 6, 18, 7, 0, 0, + originalDate = new DateTimeOffset(2008, 6, 18, 7, 0, 0, new TimeSpan(-5, 0, 0)); localDate = originalDate.LocalDateTime; - Console.WriteLine("{0} converted to {1} {2}", - originalDate, - localDate, + Console.WriteLine("{0} converted to {1} {2}", + originalDate, + localDate, localDate.Kind.ToString()); - // Convert time originating in a different time zone + // Convert time originating in a different time zone // so local time zone's adjustment rules are applied - originalDate = new DateTimeOffset(2007, 11, 4, 4, 0, 0, + originalDate = new DateTimeOffset(2007, 11, 4, 4, 0, 0, new TimeSpan(-5, 0, 0)); localDate = originalDate.LocalDateTime; - Console.WriteLine("{0} converted to {1} {2}", - originalDate, - localDate, + Console.WriteLine("{0} converted to {1} {2}", + originalDate, + localDate, localDate.Kind.ToString()); // The example displays the following output to the console: // 6/19/2008 7:00:00 AM -05:00 converted to 6/19/2008 5:00:00 AM Local @@ -281,12 +281,12 @@ private static void PerformUtcAndTypeConversion() // DateTimeOffset originalTime = new DateTimeOffset(2008, 6, 19, 7, 0, 0, new TimeSpan(5, 0, 0)); DateTime utcTime = originalTime.UtcDateTime; - Console.WriteLine("{0} converted to {1} {2}", - originalTime, - utcTime, + Console.WriteLine("{0} converted to {1} {2}", + originalTime, + utcTime, utcTime.Kind.ToString()); // The example displays the following output to the console: // 6/19/2008 7:00:00 AM +05:00 converted to 6/19/2008 2:00:00 AM Utc - // + // } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.DateTimeOffset.Conceptual.Instantiate/cs/Instantiate.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.DateTimeOffset.Conceptual.Instantiate/cs/Instantiate.cs index 684453fb708a8..f2773bc52298b 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.DateTimeOffset.Conceptual.Instantiate/cs/Instantiate.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.DateTimeOffset.Conceptual.Instantiate/cs/Instantiate.cs @@ -21,32 +21,32 @@ private static void CallConstructors() { // DateTimeOffset dateAndTime; - - // Instantiate date and time using years, months, days, + + // Instantiate date and time using years, months, days, // hours, minutes, and seconds - dateAndTime = new DateTimeOffset(2008, 5, 1, 8, 6, 32, + dateAndTime = new DateTimeOffset(2008, 5, 1, 8, 6, 32, new TimeSpan(1, 0, 0)); Console.WriteLine(dateAndTime); // Instantiate date and time using years, months, days, // hours, minutes, seconds, and milliseconds - dateAndTime = new DateTimeOffset(2008, 5, 1, 8, 6, 32, 545, + dateAndTime = new DateTimeOffset(2008, 5, 1, 8, 6, 32, 545, new TimeSpan(1, 0, 0)); - Console.WriteLine("{0} {1}", dateAndTime.ToString("G"), + Console.WriteLine("{0} {1}", dateAndTime.ToString("G"), dateAndTime.ToString("zzz")); - + // Instantiate date and time using Persian calendar with years, // months, days, hours, minutes, seconds, and milliseconds - dateAndTime = new DateTimeOffset(1387, 2, 12, 8, 6, 32, 545, - new PersianCalendar(), + dateAndTime = new DateTimeOffset(1387, 2, 12, 8, 6, 32, 545, + new PersianCalendar(), new TimeSpan(1, 0, 0)); // Note that the console output displays the date in the Gregorian - // calendar, not the Persian calendar. - Console.WriteLine("{0} {1}", dateAndTime.ToString("G"), + // calendar, not the Persian calendar. + Console.WriteLine("{0} {1}", dateAndTime.ToString("G"), dateAndTime.ToString("zzz")); - + // Instantiate date and time using number of ticks // 05/01/2008 8:06:32 AM is 633,452,259,920,000,000 ticks - dateAndTime = new DateTimeOffset(633452259920000000, new TimeSpan(1, 0, 0)); + dateAndTime = new DateTimeOffset(633452259920000000, new TimeSpan(1, 0, 0)); Console.WriteLine(dateAndTime); // The example displays the following output to the console: // 5/1/2008 8:06:32 AM +01:00 @@ -62,20 +62,20 @@ private static void CallDateTimeConstructors() // Declare date; Kind property is DateTimeKind.Unspecified DateTime sourceDate = new DateTime(2008, 5, 1, 8, 30, 0); DateTimeOffset targetTime; - - // Instantiate a DateTimeOffset value from a UTC time + + // Instantiate a DateTimeOffset value from a UTC time DateTime utcTime = DateTime.SpecifyKind(sourceDate, DateTimeKind.Utc); targetTime = new DateTimeOffset(utcTime); Console.WriteLine(targetTime); // Displays 5/1/2008 8:30:00 AM +00:00 - // Because the Kind property is DateTimeKind.Utc, + // Because the Kind property is DateTimeKind.Utc, // the offset is TimeSpan.Zero. // Instantiate a DateTimeOffset value from a UTC time with a zero offset targetTime = new DateTimeOffset(utcTime, TimeSpan.Zero); Console.WriteLine(targetTime); // Displays 5/1/2008 8:30:00 AM +00:00 - // Because the Kind property is DateTimeKind.Utc, + // Because the Kind property is DateTimeKind.Utc, // the call to the constructor succeeds // Instantiate a DateTimeOffset value from a UTC time with a negative offset @@ -86,25 +86,25 @@ private static void CallDateTimeConstructors() } catch (ArgumentException) { - Console.WriteLine("Attempt to create DateTimeOffset value from {0} failed.", + Console.WriteLine("Attempt to create DateTimeOffset value from {0} failed.", targetTime); - } + } // Throws exception and displays the following to the console: // Attempt to create DateTimeOffset value from 5/1/2008 8:30:00 AM +00:00 failed. - + // Instantiate a DateTimeOffset value from a local time DateTime localTime = DateTime.SpecifyKind(sourceDate, DateTimeKind.Local); targetTime = new DateTimeOffset(localTime); Console.WriteLine(targetTime); // Displays 5/1/2008 8:30:00 AM -07:00 - // Because the Kind property is DateTimeKind.Local, + // Because the Kind property is DateTimeKind.Local, // the offset is that of the local time zone. - + // Instantiate a DateTimeOffset value from an unspecified time targetTime = new DateTimeOffset(sourceDate); Console.WriteLine(targetTime); // Displays 5/1/2008 8:30:00 AM -07:00 - // Because the Kind property is DateTimeKind.Unspecified, + // Because the Kind property is DateTimeKind.Unspecified, // the offset is that of the local time zone. // } @@ -114,15 +114,15 @@ private static void CallDateTimeWithOffsetConstructors() // DateTime sourceDate = new DateTime(2008, 5, 1, 8, 30, 0); DateTimeOffset targetTime; - + // Instantiate a DateTimeOffset value from a UTC time with a zero offset. DateTime utcTime = DateTime.SpecifyKind(sourceDate, DateTimeKind.Utc); targetTime = new DateTimeOffset(utcTime, TimeSpan.Zero); Console.WriteLine(targetTime); // Displays 5/1/2008 8:30:00 AM +00:00 - // Because the Kind property is DateTimeKind.Utc, + // Because the Kind property is DateTimeKind.Utc, // the call to the constructor succeeds - + // Instantiate a DateTimeOffset value from a UTC time with a non-zero offset. try { @@ -131,22 +131,22 @@ private static void CallDateTimeWithOffsetConstructors() } catch (ArgumentException) { - Console.WriteLine("Attempt to create DateTimeOffset value from {0} failed.", + Console.WriteLine("Attempt to create DateTimeOffset value from {0} failed.", utcTime); - } + } // Throws exception and displays the following to the console: // Attempt to create DateTimeOffset value from 5/1/2008 8:30:00 AM failed. - // Instantiate a DateTimeOffset value from a local time with + // Instantiate a DateTimeOffset value from a local time with // the offset of the local time zone DateTime localTime = DateTime.SpecifyKind(sourceDate, DateTimeKind.Local); - targetTime = new DateTimeOffset(localTime, + targetTime = new DateTimeOffset(localTime, TimeZoneInfo.Local.GetUtcOffset(localTime)); Console.WriteLine(targetTime); // Displays 5/1/2008 8:30:00 AM -07:00 // Because the Kind property is DateTimeKind.Local and the offset matches // that of the local time zone, the call to the constructor succeeds. - + // Instantiate a DateTimeOffset value from a local time with a zero offset. try { @@ -155,43 +155,43 @@ private static void CallDateTimeWithOffsetConstructors() } catch (ArgumentException) { - Console.WriteLine("Attempt to create DateTimeOffset value from {0} failed.", + Console.WriteLine("Attempt to create DateTimeOffset value from {0} failed.", localTime); - } + } // Throws exception and displays the following to the console: // Attempt to create DateTimeOffset value from 5/1/2008 8:30:00 AM failed. - - // Instantiate a DateTimeOffset value with an arbitary time zone. + + // Instantiate a DateTimeOffset value with an arbitary time zone. string timeZoneName = "Central Standard Time"; - TimeSpan offset = TimeZoneInfo.FindSystemTimeZoneById(timeZoneName). - GetUtcOffset(sourceDate); + TimeSpan offset = TimeZoneInfo.FindSystemTimeZoneById(timeZoneName). + GetUtcOffset(sourceDate); targetTime = new DateTimeOffset(sourceDate, offset); Console.WriteLine(targetTime); // Displays 5/1/2008 8:30:00 AM -05:00 - // + // } private static void CastToDateTimeOffset() { - // + // DateTimeOffset targetTime; - + // The Kind property of sourceDate is DateTimeKind.Unspecified DateTime sourceDate = new DateTime(2008, 5, 1, 8, 30, 0); targetTime = sourceDate; - Console.WriteLine(targetTime); + Console.WriteLine(targetTime); // Displays 5/1/2008 8:30:00 AM -07:00 - + // define a UTC time (Kind property is DateTimeKind.Utc) DateTime utcTime = DateTime.SpecifyKind(sourceDate, DateTimeKind.Utc); targetTime = utcTime; - Console.WriteLine(targetTime); + Console.WriteLine(targetTime); // Displays 5/1/2008 8:30:00 AM +00:00 // Define a local time (Kind property is DateTimeKind.Local) DateTime localTime = DateTime.SpecifyKind(sourceDate, DateTimeKind.Local); targetTime = localTime; - Console.WriteLine(targetTime); + Console.WriteLine(targetTime); // Displays 5/1/2008 8:30:00 AM -07:00 // } @@ -199,9 +199,9 @@ private static void CastToDateTimeOffset() private static void ParseTimeString() { // - string timeString; + string timeString; DateTimeOffset targetTime; - + timeString = "05/01/2008 8:30 AM +01:00"; try { @@ -210,37 +210,37 @@ private static void ParseTimeString() } catch (FormatException) { - Console.WriteLine("Unable to parse {0}.", timeString); - } - + Console.WriteLine("Unable to parse {0}.", timeString); + } + timeString = "05/01/2008 8:30 AM"; if (DateTimeOffset.TryParse(timeString, out targetTime)) Console.WriteLine(targetTime); else - Console.WriteLine("Unable to parse {0}.", timeString); - + Console.WriteLine("Unable to parse {0}.", timeString); + timeString = "Thursday, 01 May 2008 08:30"; try { - targetTime = DateTimeOffset.ParseExact(timeString, "f", + targetTime = DateTimeOffset.ParseExact(timeString, "f", CultureInfo.InvariantCulture); Console.WriteLine(targetTime); } catch (FormatException) { - Console.WriteLine("Unable to parse {0}.", timeString); - } - + Console.WriteLine("Unable to parse {0}.", timeString); + } + timeString = "Thursday, 01 May 2008 08:30 +02:00"; - string formatString; + string formatString; formatString = CultureInfo.InvariantCulture.DateTimeFormat.LongDatePattern + " " + CultureInfo.InvariantCulture.DateTimeFormat.ShortTimePattern + - " zzz"; - if (DateTimeOffset.TryParseExact(timeString, - formatString, - CultureInfo.InvariantCulture, - DateTimeStyles.AllowLeadingWhite, + " zzz"; + if (DateTimeOffset.TryParseExact(timeString, + formatString, + CultureInfo.InvariantCulture, + DateTimeStyles.AllowLeadingWhite, out targetTime)) Console.WriteLine(targetTime); else diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.DateTimeOffset.Conceptual.OffsetConversions/cs/TimeConversions.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.DateTimeOffset.Conceptual.OffsetConversions/cs/TimeConversions.cs index 68bd630ae751d..97cb7ee04addc 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.DateTimeOffset.Conceptual.OffsetConversions/cs/TimeConversions.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.DateTimeOffset.Conceptual.OffsetConversions/cs/TimeConversions.cs @@ -14,9 +14,9 @@ public DateTimeOffset ReturnTimeOnServer(string clientString) { string format = @"M/d/yyyy H:m:s zzz"; TimeSpan serverOffset = TimeZoneInfo.Local.GetUtcOffset(DateTimeOffset.Now); - + try - { + { DateTimeOffset clientTime = DateTimeOffset.ParseExact(clientString, format, CultureInfo.InvariantCulture); DateTimeOffset serverTime = clientTime.ToOffset(serverOffset); return serverTime; diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.DateTimeOffset.Conceptual.OffsetConversions/cs/timeconversions2.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.DateTimeOffset.Conceptual.OffsetConversions/cs/timeconversions2.cs index bad5d47507751..a5d3f6fed7f41 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.DateTimeOffset.Conceptual.OffsetConversions/cs/timeconversions2.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.DateTimeOffset.Conceptual.OffsetConversions/cs/timeconversions2.cs @@ -13,12 +13,12 @@ public static void Main() public DateTimeOffset ReturnTimeOnServer(string clientString) { string format = @"M/d/yyyy H:m:s zzz"; - + try - { - DateTimeOffset clientTime = DateTimeOffset.ParseExact(clientString, format, + { + DateTimeOffset clientTime = DateTimeOffset.ParseExact(clientString, format, CultureInfo.InvariantCulture); - DateTimeOffset serverTime = TimeZoneInfo.ConvertTime(clientTime, + DateTimeOffset serverTime = TimeZoneInfo.ConvertTime(clientTime, TimeZoneInfo.Local); return serverTime; } diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.DateTimeOffset.Conceptual/cs/Conceptual1.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.DateTimeOffset.Conceptual/cs/Conceptual1.cs index 9f692391e8c1e..79239e00df00f 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.DateTimeOffset.Conceptual/cs/Conceptual1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.DateTimeOffset.Conceptual/cs/Conceptual1.cs @@ -9,11 +9,11 @@ public static void Main() DateTime thisDate = new DateTime(2007, 3, 10, 0, 0, 0); DateTime dstDate = new DateTime(2007, 6, 10, 0, 0, 0); DateTimeOffset thisTime; - + thisTime = new DateTimeOffset(dstDate, new TimeSpan(-7, 0, 0)); ShowPossibleTimeZones(thisTime); - thisTime = new DateTimeOffset(thisDate, new TimeSpan(-6, 0, 0)); + thisTime = new DateTimeOffset(thisDate, new TimeSpan(-6, 0, 0)); ShowPossibleTimeZones(thisTime); thisTime = new DateTimeOffset(thisDate, new TimeSpan(+1, 0, 0)); @@ -24,12 +24,12 @@ private static void ShowPossibleTimeZones(DateTimeOffset offsetTime) { TimeSpan offset = offsetTime.Offset; ReadOnlyCollection timeZones; - - Console.WriteLine("{0} could belong to the following time zones:", + + Console.WriteLine("{0} could belong to the following time zones:", offsetTime.ToString()); // Get all time zones defined on local system - timeZones = TimeZoneInfo.GetSystemTimeZones(); - // Iterate time zones + timeZones = TimeZoneInfo.GetSystemTimeZones(); + // Iterate time zones foreach (TimeZoneInfo timeZone in timeZones) { // Compare offset with offset for that date in that time zone @@ -37,21 +37,21 @@ private static void ShowPossibleTimeZones(DateTimeOffset offsetTime) Console.WriteLine(" {0}", timeZone.DisplayName); } Console.WriteLine(); - } + } } // This example displays the following output to the console: // 6/10/2007 12:00:00 AM -07:00 could belong to the following time zones: // (GMT-07:00) Arizona // (GMT-08:00) Pacific Time (US & Canada) // (GMT-08:00) Tijuana, Baja California -// +// // 3/10/2007 12:00:00 AM -06:00 could belong to the following time zones: // (GMT-06:00) Central America // (GMT-06:00) Central Time (US & Canada) // (GMT-06:00) Guadalajara, Mexico City, Monterrey - New // (GMT-06:00) Guadalajara, Mexico City, Monterrey - Old // (GMT-06:00) Saskatchewan -// +// // 3/10/2007 12:00:00 AM +01:00 could belong to the following time zones: // (GMT+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna // (GMT+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.DateTimeOffset.Conceptual/cs/Conceptual2.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.DateTimeOffset.Conceptual/cs/Conceptual2.cs index f2d7ea2545328..57df882252475 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.DateTimeOffset.Conceptual/cs/Conceptual2.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.DateTimeOffset.Conceptual/cs/Conceptual2.cs @@ -14,20 +14,20 @@ public static void Main() { DateTime localTime = DateTime.Now; DateTime utcTime = DateTime.UtcNow; - - Console.WriteLine("Difference between {0} and {1} time: {2}:{3} hours", - localTime.Kind.ToString(), - utcTime.Kind.ToString(), - (localTime - utcTime).Hours, + + Console.WriteLine("Difference between {0} and {1} time: {2}:{3} hours", + localTime.Kind.ToString(), + utcTime.Kind.ToString(), + (localTime - utcTime).Hours, (localTime - utcTime).Minutes); - Console.WriteLine("The {0} time is {1} the {2} time.", - localTime.Kind.ToString(), - Enum.GetName(typeof(TimeComparison), localTime.CompareTo(utcTime)), - utcTime.Kind.ToString()); + Console.WriteLine("The {0} time is {1} the {2} time.", + localTime.Kind.ToString(), + Enum.GetName(typeof(TimeComparison), localTime.CompareTo(utcTime)), + utcTime.Kind.ToString()); } } -// If run in the U.S. Pacific Standard Time zone, the example displays +// If run in the U.S. Pacific Standard Time zone, the example displays // the following output to the console: // Difference between Local and Utc time: -7:0 hours -// The Local time is EarlierThan the Utc time. +// The Local time is EarlierThan the Utc time. // diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.DateTimeOffset.Conceptual/cs/Conceptual3.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.DateTimeOffset.Conceptual/cs/Conceptual3.cs index 518f08ccb46a2..e26881f249e06 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.DateTimeOffset.Conceptual/cs/Conceptual3.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.DateTimeOffset.Conceptual/cs/Conceptual3.cs @@ -14,15 +14,15 @@ public static void Main() { DateTimeOffset localTime = DateTimeOffset.Now; DateTimeOffset utcTime = DateTimeOffset.UtcNow; - - Console.WriteLine("Difference between local time and UTC: {0}:{1:D2} hours", - (localTime - utcTime).Hours, + + Console.WriteLine("Difference between local time and UTC: {0}:{1:D2} hours", + (localTime - utcTime).Hours, (localTime - utcTime).Minutes); - Console.WriteLine("The local time is {0} UTC.", - Enum.GetName(typeof(TimeComparison), localTime.CompareTo(utcTime))); + Console.WriteLine("The local time is {0} UTC.", + Enum.GetName(typeof(TimeComparison), localTime.CompareTo(utcTime))); } } -// Regardless of the local time zone, the example displays +// Regardless of the local time zone, the example displays // the following output to the console: // Difference between local time and UTC: 0:00 hours. // The local time is TheSameAs UTC. diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.DateTimeOffset.Conceptual/cs/Conceptual4.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.DateTimeOffset.Conceptual/cs/Conceptual4.cs index 331e04ac41a57..f160104c70b2c 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.DateTimeOffset.Conceptual/cs/Conceptual4.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.DateTimeOffset.Conceptual/cs/Conceptual4.cs @@ -12,15 +12,15 @@ public static void Main() // Instantiate DateTimeOffset value to have correct CST offset try { - DateTimeOffset centralTime1 = new DateTimeOffset(generalTime, + DateTimeOffset centralTime1 = new DateTimeOffset(generalTime, TimeZoneInfo.FindSystemTimeZoneById(tzName).GetUtcOffset(generalTime)); - - // Add two and a half hours + + // Add two and a half hours DateTimeOffset centralTime2 = centralTime1.Add(twoAndAHalfHours); // Display result - Console.WriteLine("{0} + {1} hours = {2}", centralTime1, - twoAndAHalfHours.ToString(), - centralTime2); + Console.WriteLine("{0} + {1} hours = {2}", centralTime1, + twoAndAHalfHours.ToString(), + centralTime2); } catch (TimeZoneNotFoundException) { diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.DateTimeOffset.Conceptual/cs/Conceptual5.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.DateTimeOffset.Conceptual/cs/Conceptual5.cs index a03a45a398cb6..5ef61fcb6c681 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.DateTimeOffset.Conceptual/cs/Conceptual5.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.DateTimeOffset.Conceptual/cs/Conceptual5.cs @@ -6,7 +6,7 @@ public class TimeZoneAwareArithmetic public static void Main() { const string tzName = "Central Standard Time"; - + DateTime generalTime = new DateTime(2008, 3, 9, 1, 30, 0); TimeZoneInfo cst = TimeZoneInfo.FindSystemTimeZoneById(tzName); TimeSpan twoAndAHalfHours = new TimeSpan(2, 30, 0); @@ -14,18 +14,18 @@ public static void Main() // Instantiate DateTimeOffset value to have correct CST offset try { - DateTimeOffset centralTime1 = new DateTimeOffset(generalTime, + DateTimeOffset centralTime1 = new DateTimeOffset(generalTime, cst.GetUtcOffset(generalTime)); - + // Add two and a half hours DateTimeOffset utcTime = centralTime1.ToUniversalTime(); utcTime += twoAndAHalfHours; - + DateTimeOffset centralTime2 = TimeZoneInfo.ConvertTime(utcTime, cst); // Display result - Console.WriteLine("{0} + {1} hours = {2}", centralTime1, - twoAndAHalfHours.ToString(), - centralTime2); + Console.WriteLine("{0} + {1} hours = {2}", centralTime1, + twoAndAHalfHours.ToString(), + centralTime2); } catch (TimeZoneNotFoundException) { diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.DateTimeOffset.Conceptual/cs/Conceptual6.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.DateTimeOffset.Conceptual/cs/Conceptual6.cs index dec1df178fa7b..d61113912eb71 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.DateTimeOffset.Conceptual/cs/Conceptual6.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.DateTimeOffset.Conceptual/cs/Conceptual6.cs @@ -5,20 +5,20 @@ public struct TimeZoneTime { public TimeZoneInfo TimeZone; public DateTimeOffset Time; - + public TimeZoneTime(TimeZoneInfo tz, DateTimeOffset time) { - if (tz == null) + if (tz == null) throw new ArgumentNullException("The time zone cannot be a null reference."); - + this.TimeZone = tz; - this.Time = time; + this.Time = time; } public TimeZoneTime AddTime(TimeSpan interval) { // Convert time to UTC - DateTimeOffset utcTime = TimeZoneInfo.ConvertTime(this.Time, TimeZoneInfo.Utc); + DateTimeOffset utcTime = TimeZoneInfo.ConvertTime(this.Time, TimeZoneInfo.Utc); // Add time interval to time utcTime = utcTime.Add(interval); // Convert time back to time in time zone @@ -29,22 +29,22 @@ public TimeZoneTime AddTime(TimeSpan interval) public class TimeArithmetic { public const string tzName = "Central Standard Time"; - + public static void Main() { try { TimeZoneTime cstTime1, cstTime2; - + TimeZoneInfo cst = TimeZoneInfo.FindSystemTimeZoneById(tzName); - DateTime time1 = new DateTime(2008, 3, 9, 1, 30, 0); + DateTime time1 = new DateTime(2008, 3, 9, 1, 30, 0); TimeSpan twoAndAHalfHours = new TimeSpan(2, 30, 0); - - cstTime1 = new TimeZoneTime(cst, + + cstTime1 = new TimeZoneTime(cst, new DateTimeOffset(time1, cst.GetUtcOffset(time1))); cstTime2 = cstTime1.AddTime(twoAndAHalfHours); - Console.WriteLine("{0} + {1} hours = {2}", cstTime1.Time, - twoAndAHalfHours.ToString(), + Console.WriteLine("{0} + {1} hours = {2}", cstTime1.Time, + twoAndAHalfHours.ToString(), cstTime2.Time); } catch diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.DateTimeOffset.Conceptual/cs/Conceptual8.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.DateTimeOffset.Conceptual/cs/Conceptual8.cs index d66c1ca80894c..fed84fa38aadd 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.DateTimeOffset.Conceptual/cs/Conceptual8.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.DateTimeOffset.Conceptual/cs/Conceptual8.cs @@ -5,14 +5,14 @@ public struct TimeZoneTime { public TimeZoneInfo TimeZone; public DateTime Time; - + public TimeZoneTime(TimeZoneInfo tz, DateTime time) { - if (tz == null) + if (tz == null) throw new ArgumentNullException("The time zone cannot be a null reference."); - + this.TimeZone = tz; - this.Time = time; + this.Time = time; } public TimeZoneTime AddTime(TimeSpan interval) @@ -22,7 +22,7 @@ public TimeZoneTime AddTime(TimeSpan interval) // Add time interval to time utcTime = utcTime.Add(interval); // Convert time back to time in time zone - return new TimeZoneTime(this.TimeZone, TimeZoneInfo.ConvertTime(utcTime, + return new TimeZoneTime(this.TimeZone, TimeZoneInfo.ConvertTime(utcTime, TimeZoneInfo.Utc, this.TimeZone)); } } @@ -30,21 +30,21 @@ public TimeZoneTime AddTime(TimeSpan interval) public class TimeArithmetic { public const string tzName = "Central Standard Time"; - + public static void Main() { try { TimeZoneTime cstTime1, cstTime2; - + TimeZoneInfo cst = TimeZoneInfo.FindSystemTimeZoneById(tzName); - DateTime time1 = new DateTime(2008, 3, 9, 1, 30, 0); + DateTime time1 = new DateTime(2008, 3, 9, 1, 30, 0); TimeSpan twoAndAHalfHours = new TimeSpan(2, 30, 0); cstTime1 = new TimeZoneTime(cst, time1); cstTime2 = cstTime1.AddTime(twoAndAHalfHours); - Console.WriteLine("{0} + {1} hours = {2}", cstTime1.Time, - twoAndAHalfHours.ToString(), + Console.WriteLine("{0} + {1} hours = {2}", cstTime1.Time, + twoAndAHalfHours.ToString(), cstTime2.Time); } catch diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.DateTimeOffset.Methods/cs/Methods.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.DateTimeOffset.Methods/cs/Methods.cs index 82b052c0f6677..376bd86b6b9db 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.DateTimeOffset.Methods/cs/Methods.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.DateTimeOffset.Methods/cs/Methods.cs @@ -37,14 +37,14 @@ public static void Main() private static void ShowSchedule() { // - DateTimeOffset takeOff = new DateTimeOffset(2007, 6, 1, 7, 55, 0, + DateTimeOffset takeOff = new DateTimeOffset(2007, 6, 1, 7, 55, 0, new TimeSpan(-5, 0, 0)); DateTimeOffset currentTime = takeOff; TimeSpan[] flightTimes = new TimeSpan[] {new TimeSpan(2, 25, 0), new TimeSpan(1, 48, 0)}; - Console.WriteLine("Takeoff is scheduled for {0:d} at {0:T}.", + Console.WriteLine("Takeoff is scheduled for {0:d} at {0:T}.", takeOff); - for (int ctr = flightTimes.GetLowerBound(0); + for (int ctr = flightTimes.GetLowerBound(0); ctr <= flightTimes.GetUpperBound(0); ctr++) { currentTime = currentTime.Add(flightTimes[ctr]); @@ -56,7 +56,7 @@ private static void ShowSchedule() private static void ShowStartOfWorkWeek() { // - DateTimeOffset workDay = new DateTimeOffset(2008, 3, 1, 9, 0, 0, + DateTimeOffset workDay = new DateTimeOffset(2008, 3, 1, 9, 0, 0, DateTimeOffset.Now.Offset); int month = workDay.Month; // Start with the first Monday of the month @@ -64,38 +64,38 @@ private static void ShowStartOfWorkWeek() { if (workDay.DayOfWeek == DayOfWeek.Sunday) workDay = workDay.AddDays(1); - else + else workDay = workDay.AddDays(8 - (int)workDay.DayOfWeek); } Console.WriteLine("Beginning of Work Week In {0:MMMM} {0:yyyy}:", workDay); - // Add one week to the current date - do + // Add one week to the current date + do { Console.WriteLine(" {0:dddd}, {0:MMMM}{0: d}", workDay); workDay = workDay.AddDays(7); - } while (workDay.Month == month); + } while (workDay.Month == month); // The example produces the following output: // Beginning of Work Week In March 2008: // Monday, March 3 // Monday, March 10 // Monday, March 17 // Monday, March 24 - // Monday, March 31 - // + // Monday, March 31 + // } private static void ShowShiftStartTimes() { - // + // const int SHIFT_LENGTH = 8; - - DateTimeOffset startTime = new DateTimeOffset(2007, 8, 6, 0, 0, 0, + + DateTimeOffset startTime = new DateTimeOffset(2007, 8, 6, 0, 0, 0, DateTimeOffset.Now.Offset); DateTimeOffset startOfShift = startTime.AddHours(SHIFT_LENGTH); - + Console.WriteLine("Shifts for the week of {0:D}", startOfShift); do - { + { // Exclude third shift if (startOfShift.Hour > 6) Console.WriteLine(" {0:d} at {0:T}", startOfShift); @@ -115,40 +115,40 @@ private static void ShowShiftStartTimes() // 8/9/2007 at 8:00:00 AM // 8/9/2007 at 4:00:00 PM // 8/10/2007 at 8:00:00 AM - // 8/10/2007 at 4:00:00 PM - // + // 8/10/2007 at 4:00:00 PM + // } private static void ShowQuarters() { // - DateTimeOffset quarterDate = new DateTimeOffset(2007, 1, 1, 0, 0, 0, + DateTimeOffset quarterDate = new DateTimeOffset(2007, 1, 1, 0, 0, 0, DateTimeOffset.Now.Offset); for (int ctr = 1; ctr <= 4; ctr++) { Console.WriteLine("Quarter {0}: {1:MMMM d}", ctr, quarterDate); quarterDate = quarterDate.AddMonths(3); - } + } // This example produces the following output: // Quarter 1: January 1 // Quarter 2: April 1 // Quarter 3: July 1 - // Quarter 4: October 1 + // Quarter 4: October 1 // } private static void DisplayTimes() { // - double[] lapTimes = {1.308, 1.283, 1.325, 1.3625, 1.317, 1.267}; - DateTimeOffset currentTime = new DateTimeOffset(1, 1, 1, 1, 30, 0, + double[] lapTimes = {1.308, 1.283, 1.325, 1.3625, 1.317, 1.267}; + DateTimeOffset currentTime = new DateTimeOffset(1, 1, 1, 1, 30, 0, DateTimeOffset.Now.Offset); Console.WriteLine("Start: {0:T}", currentTime); for (int ctr = lapTimes.GetLowerBound(0); ctr <= lapTimes.GetUpperBound(0); ctr++) { currentTime = currentTime.AddMinutes(lapTimes[ctr]); Console.WriteLine("Lap {0}: {1:T}", ctr + 1, currentTime); - } + } // The example produces the following output: // Start: 1:30:00 PM // Lap 1: 1:31:18 PM @@ -156,181 +156,181 @@ private static void DisplayTimes() // Lap 3: 1:33:54 PM // Lap 4: 1:35:16 PM // Lap 5: 1:36:35 PM - // Lap 6: 1:37:51 PM + // Lap 6: 1:37:51 PM // - } + } private static void ShowLegalLicenseAge() - { + { // const int minimumAge = 16; DateTimeOffset dateToday = DateTimeOffset.Now; DateTimeOffset latestBirthday = dateToday.AddYears(-1 * minimumAge); - Console.WriteLine("To possess a driver's license, you must have been born on or before {0:d}.", + Console.WriteLine("To possess a driver's license, you must have been born on or before {0:d}.", latestBirthday); - // - } + // + } // private static void CompareForEquality1() { - DateTimeOffset firstTime = new DateTimeOffset(2007, 9, 1, 6, 45, 0, + DateTimeOffset firstTime = new DateTimeOffset(2007, 9, 1, 6, 45, 0, new TimeSpan(-7, 0, 0)); DateTimeOffset secondTime = firstTime; - Console.WriteLine("{0} = {1}: {2}", - firstTime, secondTime, + Console.WriteLine("{0} = {1}: {2}", + firstTime, secondTime, firstTime.Equals(secondTime)); - secondTime = new DateTimeOffset(2007, 9, 1, 6, 45, 0, - new TimeSpan(-6, 0, 0)); - Console.WriteLine("{0} = {1}: {2}", - firstTime, secondTime, + secondTime = new DateTimeOffset(2007, 9, 1, 6, 45, 0, + new TimeSpan(-6, 0, 0)); + Console.WriteLine("{0} = {1}: {2}", + firstTime, secondTime, firstTime.Equals(secondTime)); - - secondTime = new DateTimeOffset(2007, 9, 1, 8, 45, 0, + + secondTime = new DateTimeOffset(2007, 9, 1, 8, 45, 0, new TimeSpan(-5, 0, 0)); - Console.WriteLine("{0} = {1}: {2}", - firstTime, secondTime, + Console.WriteLine("{0} = {1}: {2}", + firstTime, secondTime, firstTime.Equals(secondTime)); // The example displays the following output to the console: // 9/1/2007 6:45:00 AM -07:00 = 9/1/2007 6:45:00 AM -07:00: True // 9/1/2007 6:45:00 AM -07:00 = 9/1/2007 6:45:00 AM -06:00: False - // 9/1/2007 6:45:00 AM -07:00 = 9/1/2007 8:45:00 AM -05:00: True + // 9/1/2007 6:45:00 AM -07:00 = 9/1/2007 8:45:00 AM -05:00: True // - } - + } + // private static void CompareForEquality2() { - DateTimeOffset firstTime = new DateTimeOffset(2007, 9, 1, 6, 45, 0, + DateTimeOffset firstTime = new DateTimeOffset(2007, 9, 1, 6, 45, 0, new TimeSpan(-7, 0, 0)); object secondTime = firstTime; - Console.WriteLine("{0} = {1}: {2}", - firstTime, secondTime, + Console.WriteLine("{0} = {1}: {2}", + firstTime, secondTime, firstTime.Equals(secondTime)); - secondTime = new DateTimeOffset(2007, 9, 1, 6, 45, 0, - new TimeSpan(-6, 0, 0)); - Console.WriteLine("{0} = {1}: {2}", - firstTime, secondTime, + secondTime = new DateTimeOffset(2007, 9, 1, 6, 45, 0, + new TimeSpan(-6, 0, 0)); + Console.WriteLine("{0} = {1}: {2}", + firstTime, secondTime, firstTime.Equals(secondTime)); - - secondTime = new DateTimeOffset(2007, 9, 1, 8, 45, 0, + + secondTime = new DateTimeOffset(2007, 9, 1, 8, 45, 0, new TimeSpan(-5, 0, 0)); - Console.WriteLine("{0} = {1}: {2}", - firstTime, secondTime, + Console.WriteLine("{0} = {1}: {2}", + firstTime, secondTime, firstTime.Equals(secondTime)); - + secondTime = null; - Console.WriteLine("{0} = {1}: {2}", - firstTime, secondTime, + Console.WriteLine("{0} = {1}: {2}", + firstTime, secondTime, firstTime.Equals(secondTime)); - secondTime = new DateTime(2007, 9, 1, 6, 45, 00); - Console.WriteLine("{0} = {1}: {2}", - firstTime, secondTime, + secondTime = new DateTime(2007, 9, 1, 6, 45, 00); + Console.WriteLine("{0} = {1}: {2}", + firstTime, secondTime, firstTime.Equals(secondTime)); // The example displays the following output to the console: - // 9/1/2007 6:45:00 AM -07:00 = 9/1/2007 6:45:00 AM -07:00: True - // 9/1/2007 6:45:00 AM -07:00 = 9/1/2007 6:45:00 AM -06:00: False - // 9/1/2007 6:45:00 AM -07:00 = 9/1/2007 8:45:00 AM -05:00: True - // 9/1/2007 6:45:00 AM -07:00 = : False - // 9/1/2007 6:45:00 AM -07:00 = 9/1/2007 6:45:00 AM: False + // 9/1/2007 6:45:00 AM -07:00 = 9/1/2007 6:45:00 AM -07:00: True + // 9/1/2007 6:45:00 AM -07:00 = 9/1/2007 6:45:00 AM -06:00: False + // 9/1/2007 6:45:00 AM -07:00 = 9/1/2007 8:45:00 AM -05:00: True + // 9/1/2007 6:45:00 AM -07:00 = : False + // 9/1/2007 6:45:00 AM -07:00 = 9/1/2007 6:45:00 AM: False // } private static void CompareForEquality3() { // - DateTimeOffset firstTime = new DateTimeOffset(2007, 11, 15, 11, 35, 00, + DateTimeOffset firstTime = new DateTimeOffset(2007, 11, 15, 11, 35, 00, DateTimeOffset.Now.Offset); DateTimeOffset secondTime = firstTime; - Console.WriteLine("{0} = {1}: {2}", - firstTime, secondTime, + Console.WriteLine("{0} = {1}: {2}", + firstTime, secondTime, DateTimeOffset.Equals(firstTime, secondTime)); // The value of firstTime remains unchanged - secondTime = new DateTimeOffset(firstTime.DateTime, - TimeSpan.FromHours(firstTime.Offset.Hours + 1)); - Console.WriteLine("{0} = {1}: {2}", - firstTime, secondTime, + secondTime = new DateTimeOffset(firstTime.DateTime, + TimeSpan.FromHours(firstTime.Offset.Hours + 1)); + Console.WriteLine("{0} = {1}: {2}", + firstTime, secondTime, DateTimeOffset.Equals(firstTime, secondTime)); - + // value of firstTime remains unchanged - secondTime = new DateTimeOffset(firstTime.DateTime + TimeSpan.FromHours(1), + secondTime = new DateTimeOffset(firstTime.DateTime + TimeSpan.FromHours(1), TimeSpan.FromHours(firstTime.Offset.Hours + 1)); - Console.WriteLine("{0} = {1}: {2}", - firstTime, secondTime, + Console.WriteLine("{0} = {1}: {2}", + firstTime, secondTime, DateTimeOffset.Equals(firstTime, secondTime)); // The example produces the following output: // 11/15/2007 11:35:00 AM -07:00 = 11/15/2007 11:35:00 AM -07:00: True // 11/15/2007 11:35:00 AM -07:00 = 11/15/2007 11:35:00 AM -06:00: False - // 11/15/2007 11:35:00 AM -07:00 = 11/15/2007 12:35:00 PM -06:00: True - // - } + // 11/15/2007 11:35:00 AM -07:00 = 11/15/2007 12:35:00 PM -06:00: True + // + } private static void CompareExactly() { // - DateTimeOffset instanceTime = new DateTimeOffset(2007, 10, 31, 0, 0, 0, + DateTimeOffset instanceTime = new DateTimeOffset(2007, 10, 31, 0, 0, 0, DateTimeOffset.Now.Offset); - + DateTimeOffset otherTime = instanceTime; - Console.WriteLine("{0} = {1}: {2}", - instanceTime, otherTime, + Console.WriteLine("{0} = {1}: {2}", + instanceTime, otherTime, instanceTime.EqualsExact(otherTime)); - - otherTime = new DateTimeOffset(instanceTime.DateTime, + + otherTime = new DateTimeOffset(instanceTime.DateTime, TimeSpan.FromHours(instanceTime.Offset.Hours + 1)); - Console.WriteLine("{0} = {1}: {2}", - instanceTime, otherTime, + Console.WriteLine("{0} = {1}: {2}", + instanceTime, otherTime, instanceTime.EqualsExact(otherTime)); - - otherTime = new DateTimeOffset(instanceTime.DateTime + TimeSpan.FromHours(1), + + otherTime = new DateTimeOffset(instanceTime.DateTime + TimeSpan.FromHours(1), TimeSpan.FromHours(instanceTime.Offset.Hours + 1)); - Console.WriteLine("{0} = {1}: {2}", + Console.WriteLine("{0} = {1}: {2}", instanceTime, otherTime, instanceTime.EqualsExact(otherTime)); // The example produces the following output: // 10/31/2007 12:00:00 AM -07:00 = 10/31/2007 12:00:00 AM -07:00: True // 10/31/2007 12:00:00 AM -07:00 = 10/31/2007 12:00:00 AM -06:00: False - // 10/31/2007 12:00:00 AM -07:00 = 10/31/2007 1:00:00 AM -06:00: False - // - } + // 10/31/2007 12:00:00 AM -07:00 = 10/31/2007 1:00:00 AM -06:00: False + // + } private static void Subtract1() { // - DateTimeOffset firstDate = new DateTimeOffset(2018, 10, 25, 18, 0, 0, + DateTimeOffset firstDate = new DateTimeOffset(2018, 10, 25, 18, 0, 0, new TimeSpan(-7, 0, 0)); - DateTimeOffset secondDate = new DateTimeOffset(2018, 10, 25, 18, 0, 0, + DateTimeOffset secondDate = new DateTimeOffset(2018, 10, 25, 18, 0, 0, new TimeSpan(-5, 0, 0)); - DateTimeOffset thirdDate = new DateTimeOffset(2018, 9, 28, 9, 0, 0, + DateTimeOffset thirdDate = new DateTimeOffset(2018, 9, 28, 9, 0, 0, new TimeSpan(-7, 0, 0)); TimeSpan difference; - + difference = firstDate.Subtract(secondDate); Console.WriteLine($"({firstDate}) - ({secondDate}): {difference.Days} days, {difference.Hours}:{difference.Minutes:d2}"); difference = firstDate.Subtract(thirdDate); Console.WriteLine($"({firstDate}) - ({thirdDate}): {difference.Days} days, {difference.Hours}:{difference.Minutes:d2}"); - + // The example produces the following output: // (10/25/2018 6:00:00 PM -07:00) - (10/25/2018 6:00:00 PM -05:00): 0 days, 2:00 // (10/25/2018 6:00:00 PM -07:00) - (9/28/2018 9:00:00 AM -07:00): 27 days, 9:00 - // + // } private static void Subtract2() { - // - DateTimeOffset offsetDate = new DateTimeOffset(2007, 12, 3, 11, 30, 0, - new TimeSpan(-8, 0, 0)); + // + DateTimeOffset offsetDate = new DateTimeOffset(2007, 12, 3, 11, 30, 0, + new TimeSpan(-8, 0, 0)); TimeSpan duration = new TimeSpan(7, 18, 0, 0); Console.WriteLine(offsetDate.Subtract(duration).ToString()); // Displays 11/25/2007 5:30:00 PM -08:00 - // + // } private static void ConvertToLocal() @@ -338,81 +338,81 @@ private static void ConvertToLocal() // // Local time changes on 3/11/2007 at 2:00 AM DateTimeOffset originalTime, localTime; - - originalTime = new DateTimeOffset(2007, 3, 11, 3, 0, 0, + + originalTime = new DateTimeOffset(2007, 3, 11, 3, 0, 0, new TimeSpan(-6, 0, 0)); localTime = originalTime.ToLocalTime(); - Console.WriteLine("Converted {0} to {1}.", originalTime.ToString(), - localTime.ToString()); + Console.WriteLine("Converted {0} to {1}.", originalTime.ToString(), + localTime.ToString()); - originalTime = new DateTimeOffset(2007, 3, 11, 4, 0, 0, + originalTime = new DateTimeOffset(2007, 3, 11, 4, 0, 0, new TimeSpan(-6, 0, 0)); localTime = originalTime.ToLocalTime(); - Console.WriteLine("Converted {0} to {1}.", originalTime.ToString(), - localTime.ToString()); + Console.WriteLine("Converted {0} to {1}.", originalTime.ToString(), + localTime.ToString()); // Define a summer UTC time - originalTime = new DateTimeOffset(2007, 6, 15, 8, 0, 0, + originalTime = new DateTimeOffset(2007, 6, 15, 8, 0, 0, TimeSpan.Zero); localTime = originalTime.ToLocalTime(); Console.WriteLine("Converted {0} to {1}.", originalTime.ToString(), - localTime.ToString()); + localTime.ToString()); // Define a winter time - originalTime = new DateTimeOffset(2007, 11, 30, 14, 0, 0, + originalTime = new DateTimeOffset(2007, 11, 30, 14, 0, 0, new TimeSpan(3, 0, 0)); localTime = originalTime.ToLocalTime(); - Console.WriteLine("Converted {0} to {1}.", originalTime.ToString(), + Console.WriteLine("Converted {0} to {1}.", originalTime.ToString(), localTime.ToString()); // The example produces the following output: // Converted 3/11/2007 3:00:00 AM -06:00 to 3/11/2007 1:00:00 AM -08:00. // Converted 3/11/2007 4:00:00 AM -06:00 to 3/11/2007 3:00:00 AM -07:00. // Converted 6/15/2007 8:00:00 AM +00:00 to 6/15/2007 1:00:00 AM -07:00. - // Converted 11/30/2007 2:00:00 PM +03:00 to 11/30/2007 3:00:00 AM -08:00. - // - } - + // Converted 11/30/2007 2:00:00 PM +03:00 to 11/30/2007 3:00:00 AM -08:00. + // + } + private static void ConvertToUniversal() { // DateTimeOffset localTime, otherTime, universalTime; - + // Define local time in local time zone localTime = new DateTimeOffset(new DateTime(2007, 6, 15, 12, 0, 0)); Console.WriteLine("Local time: {0}", localTime); Console.WriteLine(); - + // Convert local time to offset 0 and assign to otherTime otherTime = localTime.ToOffset(TimeSpan.Zero); Console.WriteLine("Other time: {0}", otherTime); - Console.WriteLine("{0} = {1}: {2}", - localTime, otherTime, + Console.WriteLine("{0} = {1}: {2}", + localTime, otherTime, localTime.Equals(otherTime)); - Console.WriteLine("{0} exactly equals {1}: {2}", - localTime, otherTime, + Console.WriteLine("{0} exactly equals {1}: {2}", + localTime, otherTime, localTime.EqualsExact(otherTime)); Console.WriteLine(); - + // Convert other time to UTC - universalTime = localTime.ToUniversalTime(); + universalTime = localTime.ToUniversalTime(); Console.WriteLine("Universal time: {0}", universalTime); - Console.WriteLine("{0} = {1}: {2}", - otherTime, universalTime, + Console.WriteLine("{0} = {1}: {2}", + otherTime, universalTime, universalTime.Equals(otherTime)); - Console.WriteLine("{0} exactly equals {1}: {2}", - otherTime, universalTime, + Console.WriteLine("{0} exactly equals {1}: {2}", + otherTime, universalTime, universalTime.EqualsExact(otherTime)); Console.WriteLine(); // The example produces the following output to the console: // Local time: 6/15/2007 12:00:00 PM -07:00 - // + // // Other time: 6/15/2007 7:00:00 PM +00:00 // 6/15/2007 12:00:00 PM -07:00 = 6/15/2007 7:00:00 PM +00:00: True // 6/15/2007 12:00:00 PM -07:00 exactly equals 6/15/2007 7:00:00 PM +00:00: False - // + // // Universal time: 6/15/2007 7:00:00 PM +00:00 // 6/15/2007 7:00:00 PM +00:00 = 6/15/2007 7:00:00 PM +00:00: True - // 6/15/2007 7:00:00 PM +00:00 exactly equals 6/15/2007 7:00:00 PM +00:00: True - // - } + // 6/15/2007 7:00:00 PM +00:00 exactly equals 6/15/2007 7:00:00 PM +00:00: True + // + } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.DateTimeOffset.Methods/cs/Methods2.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.DateTimeOffset.Methods/cs/Methods2.cs index 9627a33016ec2..108bf6c036e3f 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.DateTimeOffset.Methods/cs/Methods2.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.DateTimeOffset.Methods/cs/Methods2.cs @@ -4,37 +4,37 @@ public class CompareTimes { private enum TimeComparison - { + { Earlier = -1, Same = 0, Later = 1 }; - + public static void Main() { - DateTimeOffset firstTime = new DateTimeOffset(2007, 9, 1, 6, 45, 0, + DateTimeOffset firstTime = new DateTimeOffset(2007, 9, 1, 6, 45, 0, new TimeSpan(-7, 0, 0)); DateTimeOffset secondTime = firstTime; - Console.WriteLine("Comparing {0} and {1}: {2}", - firstTime, secondTime, + Console.WriteLine("Comparing {0} and {1}: {2}", + firstTime, secondTime, (TimeComparison) DateTimeOffset.Compare(firstTime, secondTime)); - secondTime = new DateTimeOffset(2007, 9, 1, 6, 45, 0, - new TimeSpan(-6, 0, 0)); - Console.WriteLine("Comparing {0} and {1}: {2}", - firstTime, secondTime, + secondTime = new DateTimeOffset(2007, 9, 1, 6, 45, 0, + new TimeSpan(-6, 0, 0)); + Console.WriteLine("Comparing {0} and {1}: {2}", + firstTime, secondTime, (TimeComparison) DateTimeOffset.Compare(firstTime, secondTime)); - - secondTime = new DateTimeOffset(2007, 9, 1, 8, 45, 0, + + secondTime = new DateTimeOffset(2007, 9, 1, 8, 45, 0, new TimeSpan(-5, 0, 0)); - Console.WriteLine("Comparing {0} and {1}: {2}", - firstTime, secondTime, + Console.WriteLine("Comparing {0} and {1}: {2}", + firstTime, secondTime, (TimeComparison) DateTimeOffset.Compare(firstTime, secondTime)); // The example displays the following output to the console: // Comparing 9/1/2007 6:45:00 AM -07:00 and 9/1/2007 6:45:00 AM -07:00: Same // Comparing 9/1/2007 6:45:00 AM -07:00 and 9/1/2007 6:45:00 AM -06:00: Later - // Comparing 9/1/2007 6:45:00 AM -07:00 and 9/1/2007 8:45:00 AM -05:00: Same + // Comparing 9/1/2007 6:45:00 AM -07:00 and 9/1/2007 8:45:00 AM -05:00: Same } } // diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.DateTimeOffset.Methods/cs/Methods3.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.DateTimeOffset.Methods/cs/Methods3.cs index 000580a6ec414..998bd30eb1689 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.DateTimeOffset.Methods/cs/Methods3.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.DateTimeOffset.Methods/cs/Methods3.cs @@ -4,37 +4,37 @@ public class CompareTimes { private enum TimeComparison - { + { Earlier = -1, Same = 0, Later = 1 }; - + public static void Main() { - DateTimeOffset firstTime = new DateTimeOffset(2007, 9, 1, 6, 45, 0, + DateTimeOffset firstTime = new DateTimeOffset(2007, 9, 1, 6, 45, 0, new TimeSpan(-7, 0, 0)); DateTimeOffset secondTime = firstTime; - Console.WriteLine("Comparing {0} and {1}: {2}", - firstTime, secondTime, + Console.WriteLine("Comparing {0} and {1}: {2}", + firstTime, secondTime, (TimeComparison) firstTime.CompareTo(secondTime)); - secondTime = new DateTimeOffset(2007, 9, 1, 6, 45, 0, - new TimeSpan(-6, 0, 0)); - Console.WriteLine("Comparing {0} and {1}: {2}", - firstTime, secondTime, + secondTime = new DateTimeOffset(2007, 9, 1, 6, 45, 0, + new TimeSpan(-6, 0, 0)); + Console.WriteLine("Comparing {0} and {1}: {2}", + firstTime, secondTime, (TimeComparison) firstTime.CompareTo(secondTime)); - - secondTime = new DateTimeOffset(2007, 9, 1, 8, 45, 0, + + secondTime = new DateTimeOffset(2007, 9, 1, 8, 45, 0, new TimeSpan(-5, 0, 0)); - Console.WriteLine("Comparing {0} and {1}: {2}", - firstTime, secondTime, + Console.WriteLine("Comparing {0} and {1}: {2}", + firstTime, secondTime, (TimeComparison) firstTime.CompareTo(secondTime)); // The example displays the following output to the console: // Comparing 9/1/2007 6:45:00 AM -07:00 and 9/1/2007 6:45:00 AM -07:00: Same // Comparing 9/1/2007 6:45:00 AM -07:00 and 9/1/2007 6:45:00 AM -06:00: Later - // Comparing 9/1/2007 6:45:00 AM -07:00 and 9/1/2007 8:45:00 AM -05:00: Same + // Comparing 9/1/2007 6:45:00 AM -07:00 and 9/1/2007 8:45:00 AM -05:00: Same } } // diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.Double.ToString/cs/ToString1.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.Double.ToString/cs/ToString1.cs index 571c08cc8bc26..e83551e10e51c 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.Double.ToString/cs/ToString1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.Double.ToString/cs/ToString1.cs @@ -18,7 +18,7 @@ private static void CallDefaultToString() { // double number; - + number = 1.6E20; // Displays 1.6E+20. Console.WriteLine(number.ToString()); @@ -26,7 +26,7 @@ private static void CallDefaultToString() number = 1.6E2; // Displays 160. Console.WriteLine(number.ToString()); - + number = -3.541; // Displays -3.541. Console.WriteLine(number.ToString()); @@ -34,15 +34,15 @@ private static void CallDefaultToString() number = -1502345222199E-07; // Displays -150234.5222199. Console.WriteLine(number.ToString()); - + number = -15023452221990199574E-09; // Displays -15023452221.9902. Console.WriteLine(number.ToString()); - + number = .60344; // Displays 0.60344. Console.WriteLine(number.ToString()); - + number = .000000001; // Displays 1E-09. Console.WriteLine(number.ToString()); @@ -53,7 +53,7 @@ private static void CallToStringWithFormatProvider() { // double value; - + value = -16325.62015; // Display value using the invariant culture. Console.WriteLine(value.ToString(CultureInfo.InvariantCulture)); @@ -76,32 +76,32 @@ private static void CallToStringWithFormatProvider() // 1.6034125E+25 // 1.6034125E+25 // 1,6034125E+25 - // + // } private static void CallToStringWithFormatString() { // - double[] numbers= {1054.32179, -195489100.8377, 1.0437E21, + double[] numbers= {1054.32179, -195489100.8377, 1.0437E21, -1.0573e-05}; - string[] specifiers = { "C", "E", "e", "F", "G", "N", "P", + string[] specifiers = { "C", "E", "e", "F", "G", "N", "P", "R", "#,000.000", "0.###E-000", "000,000,000,000.00###" }; foreach (double number in numbers) { Console.WriteLine("Formatting of {0}:", number); foreach (string specifier in specifiers) { - Console.WriteLine(" {0,-22} {1}", + Console.WriteLine(" {0,-22} {1}", specifier + ":", number.ToString(specifier)); // Add precision specifiers from 0 to 3. if (specifier.Length == 1 & ! specifier.Equals("R")) { for (int precision = 0; precision <= 3; precision++) { string pSpecifier = String.Format("{0}{1}", specifier, precision); - Console.WriteLine(" {0,-22} {1}", + Console.WriteLine(" {0,-22} {1}", pSpecifier + ":", number.ToString(pSpecifier)); - } + } Console.WriteLine(); - } + } } Console.WriteLine(); } @@ -112,192 +112,192 @@ private static void CallToStringWithFormatString() // C1: $1,054.3 // C2: $1,054.32 // C3: $1,054.322 - // + // // E: 1.054322E+003 // E0: 1E+003 // E1: 1.1E+003 // E2: 1.05E+003 // E3: 1.054E+003 - // + // // e: 1.054322e+003 // e0: 1e+003 // e1: 1.1e+003 // e2: 1.05e+003 // e3: 1.054e+003 - // + // // F: 1054.32 // F0: 1054 // F1: 1054.3 // F2: 1054.32 // F3: 1054.322 - // + // // G: 1054.32179 // G0: 1054.32179 // G1: 1E+03 // G2: 1.1E+03 // G3: 1.05E+03 - // + // // N: 1,054.32 // N0: 1,054 // N1: 1,054.3 // N2: 1,054.32 // N3: 1,054.322 - // + // // P: 105,432.18 % // P0: 105,432 % // P1: 105,432.2 % // P2: 105,432.18 % // P3: 105,432.179 % - // + // // R: 1054.32179 // #,000.000: 1,054.322 // 0.###E-000: 1.054E003 // 000,000,000,000.00###: 000,000,001,054.32179 - // + // // Formatting of -195489100.8377: // C: ($195,489,100.84) // C0: ($195,489,101) // C1: ($195,489,100.8) // C2: ($195,489,100.84) // C3: ($195,489,100.838) - // + // // E: -1.954891E+008 // E0: -2E+008 // E1: -2.0E+008 // E2: -1.95E+008 // E3: -1.955E+008 - // + // // e: -1.954891e+008 // e0: -2e+008 // e1: -2.0e+008 // e2: -1.95e+008 // e3: -1.955e+008 - // + // // F: -195489100.84 // F0: -195489101 // F1: -195489100.8 // F2: -195489100.84 // F3: -195489100.838 - // + // // G: -195489100.8377 // G0: -195489100.8377 // G1: -2E+08 // G2: -2E+08 // G3: -1.95E+08 - // + // // N: -195,489,100.84 // N0: -195,489,101 // N1: -195,489,100.8 // N2: -195,489,100.84 // N3: -195,489,100.838 - // + // // P: -19,548,910,083.77 % // P0: -19,548,910,084 % // P1: -19,548,910,083.8 % // P2: -19,548,910,083.77 % // P3: -19,548,910,083.770 % - // + // // R: -195489100.8377 // #,000.000: -195,489,100.838 // 0.###E-000: -1.955E008 // 000,000,000,000.00###: -000,195,489,100.8377 - // + // // Formatting of 1.0437E+21: // C: $1,043,700,000,000,000,000,000.00 // C0: $1,043,700,000,000,000,000,000 // C1: $1,043,700,000,000,000,000,000.0 // C2: $1,043,700,000,000,000,000,000.00 // C3: $1,043,700,000,000,000,000,000.000 - // + // // E: 1.043700E+021 // E0: 1E+021 // E1: 1.0E+021 // E2: 1.04E+021 // E3: 1.044E+021 - // + // // e: 1.043700e+021 // e0: 1e+021 // e1: 1.0e+021 // e2: 1.04e+021 // e3: 1.044e+021 - // + // // F: 1043700000000000000000.00 // F0: 1043700000000000000000 // F1: 1043700000000000000000.0 // F2: 1043700000000000000000.00 // F3: 1043700000000000000000.000 - // + // // G: 1.0437E+21 // G0: 1.0437E+21 // G1: 1E+21 // G2: 1E+21 // G3: 1.04E+21 - // + // // N: 1,043,700,000,000,000,000,000.00 // N0: 1,043,700,000,000,000,000,000 // N1: 1,043,700,000,000,000,000,000.0 // N2: 1,043,700,000,000,000,000,000.00 // N3: 1,043,700,000,000,000,000,000.000 - // + // // P: 104,370,000,000,000,000,000,000.00 % // P0: 104,370,000,000,000,000,000,000 % // P1: 104,370,000,000,000,000,000,000.0 % // P2: 104,370,000,000,000,000,000,000.00 % // P3: 104,370,000,000,000,000,000,000.000 % - // + // // R: 1.0437E+21 // #,000.000: 1,043,700,000,000,000,000,000.000 // 0.###E-000: 1.044E021 // 000,000,000,000.00###: 1,043,700,000,000,000,000,000.00 - // + // // Formatting of -1.0573E-05: // C: $0.00 // C0: $0 // C1: $0.0 // C2: $0.00 // C3: $0.000 - // + // // E: -1.057300E-005 // E0: -1E-005 // E1: -1.1E-005 // E2: -1.06E-005 // E3: -1.057E-005 - // + // // e: -1.057300e-005 // e0: -1e-005 // e1: -1.1e-005 // e2: -1.06e-005 // e3: -1.057e-005 - // + // // F: 0.00 // F0: 0 // F1: 0.0 // F2: 0.00 // F3: 0.000 - // + // // G: -1.0573E-05 // G0: -1.0573E-05 // G1: -1E-05 // G2: -1.1E-05 // G3: -1.06E-05 - // + // // N: 0.00 // N0: 0 // N1: 0.0 // N2: 0.00 // N3: 0.000 - // + // // P: 0.00 % // P0: 0 % // P1: 0.0 % // P2: 0.00 % // P3: -0.001 % - // + // // R: -1.0573E-05 // #,000.000: 000.000 // 0.###E-000: -1.057E-005 - // 000,000,000,000.00###: -000,000,000,000.00001 - // + // 000,000,000,000.00###: -000,000,000,000.00001 + // } private static void CallToStringWithFormatStringAndProvider() @@ -314,7 +314,7 @@ private static void CallToStringWithFormatStringAndProvider() // Displays: 16325,62901 Console.WriteLine(value.ToString(specifier, CultureInfo.InvariantCulture)); // Displays: 16325.62901 - + specifier = "C"; culture = CultureInfo.CreateSpecificCulture("en-US"); Console.WriteLine(value.ToString(specifier, culture)); @@ -322,15 +322,15 @@ private static void CallToStringWithFormatStringAndProvider() culture = CultureInfo.CreateSpecificCulture("en-GB"); Console.WriteLine(value.ToString(specifier, culture)); // Displays: £16,325.63 - + specifier = "E04"; culture = CultureInfo.CreateSpecificCulture("sv-SE"); Console.WriteLine(value.ToString(specifier, culture)); - // Displays: 1,6326E+004 + // Displays: 1,6326E+004 culture = CultureInfo.CreateSpecificCulture("en-NZ"); Console.WriteLine(value.ToString(specifier, culture)); - // Displays: 1.6326E+004 - + // Displays: 1.6326E+004 + specifier = "F"; culture = CultureInfo.CreateSpecificCulture("fr-FR"); Console.WriteLine(value.ToString(specifier, culture)); @@ -338,7 +338,7 @@ private static void CallToStringWithFormatStringAndProvider() culture = CultureInfo.CreateSpecificCulture("en-CA"); Console.WriteLine(value.ToString(specifier, culture)); // Displays: 16325.63 - + specifier = "N"; culture = CultureInfo.CreateSpecificCulture("es-ES"); Console.WriteLine(value.ToString(specifier, culture)); @@ -346,7 +346,7 @@ private static void CallToStringWithFormatStringAndProvider() culture = CultureInfo.CreateSpecificCulture("fr-CA"); Console.WriteLine(value.ToString(specifier, culture)); // Displays: 16 325,63 - + specifier = "P"; culture = CultureInfo.InvariantCulture; Console.WriteLine((value/10000).ToString(specifier, culture)); @@ -354,6 +354,6 @@ private static void CallToStringWithFormatStringAndProvider() culture = CultureInfo.CreateSpecificCulture("ar-EG"); Console.WriteLine((value/10000).ToString(specifier, culture)); // Displays: 163.256 % - // + // } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.Double.ToString/cs/ToString7.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.Double.ToString/cs/ToString7.cs index 922d0eec1f529..1e73b78c0adaf 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.Double.ToString/cs/ToString7.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.Double.ToString/cs/ToString7.cs @@ -6,10 +6,10 @@ public class Example public static void Main() { float number = 1764.3789m; - + // Format as a currency value. Console.WriteLine(number.ToString("C")); - + // Format as a numeric value with 3 decimal places. Console.WriteLine(number.ToString("N3")); } diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.Double/CS/doublesample.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.Double/CS/doublesample.cs index 7e58b634aad84..ef7b2e5b42eb7 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.Double/CS/doublesample.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.Double/CS/doublesample.cs @@ -1,17 +1,17 @@ using System; class DoubleSample { - public static void Main() + public static void Main() { - // + // Double d = 4.55; // - // + // Console.WriteLine("A double is of type {0}.", d.GetType().ToString()); // - // + // bool done = false; string inp; do { @@ -21,7 +21,7 @@ public static void Main() d = Double.Parse(inp); Console.WriteLine("You entered {0}.", d.ToString()); done = true; - } + } catch (FormatException) { Console.WriteLine("You did not enter a number."); } @@ -29,99 +29,99 @@ public static void Main() Console.WriteLine("You did not supply any input."); } catch (OverflowException) { - Console.WriteLine("The value you entered, {0}, is out of range.", inp); + Console.WriteLine("The value you entered, {0}, is out of range.", inp); } } while (!done); // - // - if (d > Double.MaxValue) + // + if (d > Double.MaxValue) Console.WriteLine("Your number is bigger than a double."); // - // - if (d < Double.MinValue) + // + if (d < Double.MinValue) Console.WriteLine("Your number is smaller than a double."); // - // + // Console.WriteLine("Epsilon, or the permittivity of a vacuum, has value {0}", Double.Epsilon.ToString()); // - // + // Double zero = 0; // This condition will return false. - if ((0 / zero) == Double.NaN) + if ((0 / zero) == Double.NaN) Console.WriteLine("0 / 0 can be tested with Double.NaN."); - else + else Console.WriteLine("0 / 0 cannot be tested with Double.NaN; use Double.IsNan() instead."); // - // + // // This will return true. - if (Double.IsNaN(0 / zero)) + if (Double.IsNaN(0 / zero)) Console.WriteLine("Double.IsNan() can determine whether a value is not-a-number."); // - // + // // This will equal Infinity. Console.WriteLine("10.0 minus NegativeInfinity equals {0}.", (10.0 - Double.NegativeInfinity).ToString()); // - // + // // This will equal Infinity. Console.WriteLine("PositiveInfinity plus 10.0 equals {0}.", (Double.PositiveInfinity + 10.0).ToString()); // - - // + + // // This will return "true". Console.WriteLine("IsInfinity(3.0 / 0) == {0}.", Double.IsInfinity(3.0 / 0) ? "true" : "false"); // - // + // // This will return "true". Console.WriteLine("IsPositiveInfinity(4.0 / 0) == {0}.", Double.IsPositiveInfinity(4.0 / 0) ? "true" : "false"); // - - // + + // // This will return "true". Console.WriteLine("IsNegativeInfinity(-5.0 / 0) == {0}.", Double.IsNegativeInfinity(-5.0 / 0) ? "true" : "false"); // - + // Double a = 500; Object obj1; // - - // + + // // The variables point to the same objects. Object obj2; obj1 = a; obj2 = obj1; - - if (Double.ReferenceEquals(obj1, obj2)) + + if (Double.ReferenceEquals(obj1, obj2)) Console.WriteLine("The variables point to the same double object."); - else + else Console.WriteLine("The variables point to different double objects."); // - - // + + // obj1 = (Double)450; - if (a.CompareTo(obj1) < 0) + if (a.CompareTo(obj1) < 0) Console.WriteLine("{0} is less than {1}.", a.ToString(), obj1.ToString()); - - if (a.CompareTo(obj1) > 0) + + if (a.CompareTo(obj1) > 0) Console.WriteLine("{0} is greater than {1}.", a.ToString(), obj1.ToString()); - - if (a.CompareTo(obj1) == 0) + + if (a.CompareTo(obj1) == 0) Console.WriteLine("{0} equals {1}.", a.ToString(), obj1.ToString()); // - - // + + // obj1 = (Double)500; - if (a.Equals(obj1)) + if (a.Equals(obj1)) Console.WriteLine("The value type and reference type values are equal."); // } diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.ICustomFormatter.Format/cs/format.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.ICustomFormatter.Format/cs/format.cs index 661912d289fba..294077d29cf75 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.ICustomFormatter.Format/cs/format.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.ICustomFormatter.Format/cs/format.cs @@ -10,13 +10,13 @@ public object GetFormat(Type formatType) public string Format(string format, object arg, IFormatProvider formatProvider) { string s = null; - + // - if (arg is IFormattable) + if (arg is IFormattable) s = ((IFormattable)arg).ToString(format, formatProvider); - else if (arg != null) + else if (arg != null) s = arg.ToString(); // return s; } -} +} diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter/CS/source6.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter/CS/source6.cs index 55336e53eac42..27a456498a99f 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter/CS/source6.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter/CS/source6.cs @@ -24,7 +24,7 @@ public static void Main() } } } - + using (FileStream fs = new FileStream(FILE_NAME, FileMode.Open, FileAccess.Read)) { using (BinaryReader r = new BinaryReader(fs)) diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.IO.Directory/CS/class1.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.IO.Directory/CS/class1.cs index f72e572eb4d4c..0f30be37da856 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.IO.Directory/CS/class1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.IO.Directory/CS/class1.cs @@ -7,9 +7,9 @@ namespace GetFileSystemEntries { - class Class1 + class Class1 { - static void Main(string[] args) + static void Main(string[] args) { Class1 snippets = new Class1(); @@ -23,147 +23,147 @@ static void Main(string[] args) snippets.Move("C:\\proof", "C:\\Temp"); } - void PrintFileSystemEntries(string path) + void PrintFileSystemEntries(string path) { - try + try { // Obtain the file system entries in the directory path. string[] directoryEntries = - System.IO.Directory.GetFileSystemEntries(path); + System.IO.Directory.GetFileSystemEntries(path); - foreach (string str in directoryEntries) + foreach (string str in directoryEntries) { System.Console.WriteLine(str); } } - catch (ArgumentNullException) + catch (ArgumentNullException) { System.Console.WriteLine("Path is a null reference."); } - catch (System.Security.SecurityException) + catch (System.Security.SecurityException) { System.Console.WriteLine("The caller does not have the " + "required permission."); } - catch (ArgumentException) + catch (ArgumentException) { System.Console.WriteLine("Path is an empty string, " + - "contains only white spaces, " + + "contains only white spaces, " + "or contains invalid characters."); } - catch (System.IO.DirectoryNotFoundException) + catch (System.IO.DirectoryNotFoundException) { - System.Console.WriteLine("The path encapsulated in the " + + System.Console.WriteLine("The path encapsulated in the " + "Directory object does not exist."); } } - void PrintFileSystemEntries(string path, string pattern) + void PrintFileSystemEntries(string path, string pattern) { - try + try { // Obtain the file system entries in the directory // path that match the pattern. string[] directoryEntries = - System.IO.Directory.GetFileSystemEntries(path, pattern); + System.IO.Directory.GetFileSystemEntries(path, pattern); - foreach (string str in directoryEntries) + foreach (string str in directoryEntries) { System.Console.WriteLine(str); } } - catch (ArgumentNullException) + catch (ArgumentNullException) { System.Console.WriteLine("Path is a null reference."); } - catch (System.Security.SecurityException) + catch (System.Security.SecurityException) { System.Console.WriteLine("The caller does not have the " + "required permission."); } - catch (ArgumentException) + catch (ArgumentException) { System.Console.WriteLine("Path is an empty string, " + - "contains only white spaces, " + + "contains only white spaces, " + "or contains invalid characters."); } - catch (System.IO.DirectoryNotFoundException) + catch (System.IO.DirectoryNotFoundException) { - System.Console.WriteLine("The path encapsulated in the " + + System.Console.WriteLine("The path encapsulated in the " + "Directory object does not exist."); } } // Print out all logical drives on the system. - void GetLogicalDrives() + void GetLogicalDrives() { - try + try { string[] drives = System.IO.Directory.GetLogicalDrives(); - foreach (string str in drives) + foreach (string str in drives) { System.Console.WriteLine(str); } } - catch (System.IO.IOException) + catch (System.IO.IOException) { System.Console.WriteLine("An I/O error occurs."); } - catch (System.Security.SecurityException) + catch (System.Security.SecurityException) { System.Console.WriteLine("The caller does not have the " + "required permission."); } } - void GetParent(string path) + void GetParent(string path) { - try + try { System.IO.DirectoryInfo directoryInfo = System.IO.Directory.GetParent(path); System.Console.WriteLine(directoryInfo.FullName); } - catch (ArgumentNullException) + catch (ArgumentNullException) { System.Console.WriteLine("Path is a null reference."); } - catch (ArgumentException) + catch (ArgumentException) { System.Console.WriteLine("Path is an empty string, " + "contains only white spaces, or " + "contains invalid characters."); } } - void Move(string sourcePath, string destinationPath) + void Move(string sourcePath, string destinationPath) { - try + try { System.IO.Directory.Move(sourcePath, destinationPath); System.Console.WriteLine("The directory move is complete."); } - catch (ArgumentNullException) + catch (ArgumentNullException) { System.Console.WriteLine("Path is a null reference."); } - catch (System.Security.SecurityException) + catch (System.Security.SecurityException) { System.Console.WriteLine("The caller does not have the " + "required permission."); } - catch (ArgumentException) + catch (ArgumentException) { System.Console.WriteLine("Path is an empty string, " + - "contains only white spaces, " + + "contains only white spaces, " + "or contains invalid characters."); } - catch (System.IO.IOException) + catch (System.IO.IOException) { System.Console.WriteLine("An attempt was made to move a " + "directory to a different " + "volume, or destDirName " + - "already exists."); + "already exists."); } } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.IO.Directory/CS/class6.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.IO.Directory/CS/class6.cs index f75dce4d38e61..c0df9451ce21a 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.IO.Directory/CS/class6.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.IO.Directory/CS/class6.cs @@ -13,7 +13,7 @@ static void Main(string[] args) try { - Directory.Move(sourceDirectory, destinationDirectory); + Directory.Move(sourceDirectory, destinationDirectory); } catch (Exception e) { diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.IO.Directory_Copy/cs/program.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.IO.Directory_Copy/cs/program.cs index a9f7ae6830a1f..088fed12a0277 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.IO.Directory_Copy/cs/program.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.IO.Directory_Copy/cs/program.cs @@ -28,7 +28,7 @@ private static void DirectoryCopy(string sourceDirName, string destDirName, bool { Directory.CreateDirectory(destDirName); } - + // Get the files in the directory and copy them to the new location. FileInfo[] files = dir.GetFiles(); foreach (FileInfo file in files) diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.IO.StreamReader/CS/asyncex1.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.IO.StreamReader/CS/asyncex1.cs index 709c3a5c1d638..4802fb87818d2 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.IO.StreamReader/CS/asyncex1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.IO.StreamReader/CS/asyncex1.cs @@ -14,7 +14,7 @@ static async Task ReadAndDisplayFilesAsync() { String filename = "TestFile1.txt"; Char[] buffer; - + using (var sr = new StreamReader(filename)) { buffer = new Char[(int)sr.BaseStream.Length]; await sr.ReadAsync(buffer, 0, (int)sr.BaseStream.Length); diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.IO.StreamReader/CS/example42.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.IO.StreamReader/CS/example42.cs index d567f26c58a84..140078b0374fe 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.IO.StreamReader/CS/example42.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.IO.StreamReader/CS/example42.cs @@ -24,7 +24,7 @@ private async void Button_Click_1(object sender, RoutedEventArgs e) result = new char[reader.BaseStream.Length]; await reader.ReadAsync(result, 0, (int)reader.BaseStream.Length); } - + foreach (char c in result) { if (char.IsLetterOrDigit(c) || char.IsWhiteSpace(c)) diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.IO.StreamReader/CS/program.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.IO.StreamReader/CS/program.cs index 09a69210f3cda..465f24b69d82e 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.IO.StreamReader/CS/program.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.IO.StreamReader/CS/program.cs @@ -17,7 +17,7 @@ public static void Main() Console.WriteLine("first 15 characters:"); Console.WriteLine(c); // writes - "abcdefghijklmno" - + sr.DiscardBufferedData(); sr.BaseStream.Seek(2, SeekOrigin.Begin); Console.WriteLine("\nBack to offset 2 and read to end: "); diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.IO.StreamReader/CS/streamreadersample.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.IO.StreamReader/CS/streamreadersample.cs index 3e7e3738a03af..4d6427e6dd20a 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.IO.StreamReader/CS/streamreadersample.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.IO.StreamReader/CS/streamreadersample.cs @@ -4,10 +4,10 @@ namespace StreamReaderSample { - class StreamReaderSample : TextReader + class StreamReaderSample : TextReader { - // - public StreamReaderSample() + // + public StreamReaderSample() { printInfo(); usePeek(); @@ -18,29 +18,29 @@ public StreamReaderSample() } //All Overloaded Constructors for StreamReader - // - private void getNewStreamReader() + // + private void getNewStreamReader() { //Get a new StreamReader in ASCII format from a //file using a buffer and byte order mark detection - StreamReader srAsciiFromFileFalse512 = + StreamReader srAsciiFromFileFalse512 = new StreamReader("C:\\Temp\\Test.txt", System.Text.Encoding.ASCII, false, 512); //Get a new StreamReader in ASCII format from a //file with byte order mark detection = false - StreamReader srAsciiFromFileFalse = + StreamReader srAsciiFromFileFalse = new StreamReader("C:\\Temp\\Test.txt", System.Text.Encoding.ASCII, false); - //Get a new StreamReader in ASCII format from a file - StreamReader srAsciiFromFile = + //Get a new StreamReader in ASCII format from a file + StreamReader srAsciiFromFile = new StreamReader("C:\\Temp\\Test.txt", System.Text.Encoding.ASCII); //Get a new StreamReader from a //file with byte order mark detection = false - StreamReader srFromFileFalse = + StreamReader srFromFileFalse = new StreamReader("C:\\Temp\\Test.txt", false); //Get a new StreamReader from a file - StreamReader srFromFile = + StreamReader srFromFile = new StreamReader("C:\\Temp\\Test.txt"); //Get a new StreamReader in ASCII format from a //FileStream with byte order mark detection = false and a buffer @@ -59,37 +59,37 @@ private void getNewStreamReader() //Get a new StreamReader from a //FileStream with byte order mark detection = false StreamReader srFromStreamFalse = new StreamReader( - (System.IO.Stream)File.OpenRead("C:\\Temp\\Test.txt"), + (System.IO.Stream)File.OpenRead("C:\\Temp\\Test.txt"), false); //Get a new StreamReader from a FileStream StreamReader srFromStream = new StreamReader( (System.IO.Stream)File.OpenRead("C:\\Temp\\Test.txt")); } // - // - private void printInfo() + // + private void printInfo() { // - // + // StreamReader srEncoding = new StreamReader( (System.IO.Stream)File.OpenRead("C:\\Temp\\Test.txt"), System.Text.Encoding.ASCII); - Console.WriteLine("Encoding: {0}", + Console.WriteLine("Encoding: {0}", srEncoding.CurrentEncoding.EncodingName); srEncoding.Close(); - // + // } - private void usePeek() + private void usePeek() { - // + // StreamReader srPeek = new StreamReader( (System.IO.Stream)File.OpenRead("C:\\Temp\\Test.txt"), System.Text.Encoding.ASCII); // set the file pointer to the beginning srPeek.BaseStream.Seek(0, SeekOrigin.Begin); // cycle while there is a next char - while (srPeek.Peek() > -1) + while (srPeek.Peek() > -1) { Console.Write(srPeek.ReadLine()); } @@ -98,16 +98,16 @@ private void usePeek() // } - private void usePosition() + private void usePosition() { - // + // StreamReader srRead = new StreamReader( (System.IO.Stream)File.OpenRead("C:\\Temp\\Test.txt"), System.Text.Encoding.ASCII); // set the file pointer to the beginning srRead.BaseStream.Seek(0, SeekOrigin.Begin); srRead.BaseStream.Position = 0; - while (srRead.BaseStream.Position < srRead.BaseStream.Length) + while (srRead.BaseStream.Position < srRead.BaseStream.Length) { char[] buffer = new char[1]; srRead.Read(buffer, 0, 1); @@ -119,13 +119,13 @@ private void usePosition() // } - private void useNull() + private void useNull() { - // + // StreamReader srNull = new StreamReader( (System.IO.Stream)File.OpenRead("C:\\Temp\\Test.txt"), System.Text.Encoding.ASCII); - if(!srNull.Equals(StreamReader.Null)) + if(!srNull.Equals(StreamReader.Null)) { srNull.BaseStream.Seek(0, SeekOrigin.Begin); Console.WriteLine(srNull.ReadToEnd()); @@ -133,23 +133,23 @@ private void useNull() srNull.Close(); // } - private void useReadLine() + private void useReadLine() { - // + // StreamReader srReadLine = new StreamReader( (System.IO.Stream)File.OpenRead("C:\\Temp\\Test.txt"), System.Text.Encoding.ASCII); srReadLine.BaseStream.Seek(0, SeekOrigin.Begin); - while (srReadLine.Peek() > -1) + while (srReadLine.Peek() > -1) { Console.WriteLine(srReadLine.ReadLine()); } srReadLine.Close(); // } - private void useReadToEnd() + private void useReadToEnd() { - // + // StreamReader srReadToEnd = new StreamReader( (System.IO.Stream)File.OpenRead("C:\\Temp\\Test.txt"), System.Text.Encoding.ASCII); @@ -157,10 +157,10 @@ private void useReadToEnd() Console.WriteLine(srReadToEnd.ReadToEnd()); srReadToEnd.Close(); // - // + // } // - // + // } } // diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.String.GetHashCode/CS/gethashcode.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.String.GetHashCode/CS/gethashcode.cs index be0146f6d53f7..ec30b9d63c043 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.String.GetHashCode/CS/gethashcode.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.String.GetHashCode/CS/gethashcode.cs @@ -1,9 +1,9 @@ // using System; -class GetHashCode +class GetHashCode { - public static void Main() + public static void Main() { DisplayHashCode( "" ); DisplayHashCode( "a" ); diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.String.GetHashCode/CS/perdomain.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.String.GetHashCode/CS/perdomain.cs index ab65986cc17e5..a02c2e44884d7 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.String.GetHashCode/CS/perdomain.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.String.GetHashCode/CS/perdomain.cs @@ -8,11 +8,11 @@ public static void Main() // Show hash code in current domain. DisplayString display = new DisplayString(); display.ShowStringHashCode(); - + // Create a new app domain and show string hash code. AppDomain domain = AppDomain.CreateDomain("NewDomain"); - var display2 = (DisplayString) domain.CreateInstanceAndUnwrap(typeof(Example).Assembly.FullName, - "DisplayString"); + var display2 = (DisplayString) domain.CreateInstanceAndUnwrap(typeof(Example).Assembly.FullName, + "DisplayString"); display2.ShowStringHashCode(); } } @@ -20,27 +20,27 @@ public static void Main() public class DisplayString : MarshalByRefObject { private String s = "This is a string."; - + public override bool Equals(Object obj) { - String s2 = obj as String; + String s2 = obj as String; if (s2 == null) return false; else - return s == s2; + return s == s2; } public bool Equals(String str) { return s == str; - } - + } + public override int GetHashCode() { return s.GetHashCode(); } - - public override String ToString() + + public override String ToString() { return s; } @@ -48,7 +48,7 @@ public override String ToString() public void ShowStringHashCode() { Console.WriteLine("String '{0}' in domain '{1}': {2:X8}", - s, AppDomain.CurrentDomain.FriendlyName, + s, AppDomain.CurrentDomain.FriendlyName, s.GetHashCode()); } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.Threading.ThreadStart2/CS/source.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.Threading.ThreadStart2/CS/source.cs index 1d65a4bda90fd..a71a4e38a0eb9 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.Threading.ThreadStart2/CS/source.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.Threading.ThreadStart2/CS/source.cs @@ -4,13 +4,13 @@ class Test { - static void Main() + static void Main() { // To start a thread using a static thread procedure, use the // class name and method name when you create the ThreadStart // delegate. Beginning in version 2.0 of the .NET Framework, - // it is not necessary to create a delegate explicitly. - // Specify the name of the method in the Thread constructor, + // it is not necessary to create a delegate explicitly. + // Specify the name of the method in the Thread constructor, // and the compiler selects the correct delegate. For example: // // Thread newThread = new Thread(Work.DoWork); @@ -19,8 +19,8 @@ static void Main() Thread newThread = new Thread(threadDelegate); newThread.Start(); - // To start a thread using an instance method for the thread - // procedure, use the instance variable and method name when + // To start a thread using an instance method for the thread + // procedure, use the instance variable and method name when // you create the ThreadStart delegate. Beginning in version // 2.0 of the .NET Framework, the explicit delegate is not // required. @@ -33,20 +33,20 @@ static void Main() } } -class Work +class Work { - public static void DoWork() + public static void DoWork() { - Console.WriteLine("Static thread procedure."); + Console.WriteLine("Static thread procedure."); } public int Data; - public void DoMoreWork() + public void DoMoreWork() { - Console.WriteLine("Instance thread procedure. Data={0}", Data); + Console.WriteLine("Instance thread procedure. Data={0}", Data); } } -/* This code example produces the following output (the order +/* This code example produces the following output (the order of the lines might vary): Static thread procedure. Instance thread procedure. Data=42 diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.Threading.ThreadStart2/CS/source4.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.Threading.ThreadStart2/CS/source4.cs index 88007bf7a23c8..8890726ee4e8b 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.Threading.ThreadStart2/CS/source4.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.Threading.ThreadStart2/CS/source4.cs @@ -18,18 +18,18 @@ public class ThreadWithState // The constructor obtains the state information and the // callback delegate. - public ThreadWithState(string text, int number, - ExampleCallback callbackDelegate) + public ThreadWithState(string text, int number, + ExampleCallback callbackDelegate) { boilerplate = text; numberValue = number; callback = callbackDelegate; } - + // The thread procedure performs the task, such as // formatting and printing a document, and then invokes // the callback delegate with the number of lines printed. - public void ThreadProc() + public void ThreadProc() { Console.WriteLine(boilerplate, numberValue); if (callback != null) @@ -43,9 +43,9 @@ public void ThreadProc() // Entry point for the example. // -public class Example +public class Example { - public static void Main() + public static void Main() { // Supply the state information required by the task. ThreadWithState tws = new ThreadWithState( @@ -59,13 +59,13 @@ public static void Main() Console.WriteLine("Main thread does some work, then waits."); t.Join(); Console.WriteLine( - "Independent task has completed; main thread ends."); + "Independent task has completed; main thread ends."); } // The callback method must match the signature of the // callback delegate. // - public static void ResultCallback(int lineCount) + public static void ResultCallback(int lineCount) { Console.WriteLine( "Independent task printed {0} lines.", lineCount); diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.Threading.Timer/CS/source.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.Threading.Timer/CS/source.cs index dddd80a726e85..2c0055eff14b4 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.Threading.Timer/CS/source.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.Threading.Timer/CS/source.cs @@ -9,14 +9,14 @@ static void Main() // Create an AutoResetEvent to signal the timeout threshold in the // timer callback has been reached. var autoEvent = new AutoResetEvent(false); - + var statusChecker = new StatusChecker(10); - // Create a timer that invokes CheckStatus after one second, + // Create a timer that invokes CheckStatus after one second, // and every 1/4 second thereafter. - Console.WriteLine("{0:h:mm:ss.fff} Creating timer.\n", + Console.WriteLine("{0:h:mm:ss.fff} Creating timer.\n", DateTime.Now); - var stateTimer = new Timer(statusChecker.CheckStatus, + var stateTimer = new Timer(statusChecker.CheckStatus, autoEvent, 1000, 250); // When autoEvent signals, change the period to every half second. @@ -46,8 +46,8 @@ public StatusChecker(int count) public void CheckStatus(Object stateInfo) { AutoResetEvent autoEvent = (AutoResetEvent)stateInfo; - Console.WriteLine("{0} Checking status {1,2}.", - DateTime.Now.ToString("h:mm:ss.fff"), + Console.WriteLine("{0} Checking status {1,2}.", + DateTime.Now.ToString("h:mm:ss.fff"), (++invokeCount).ToString()); if(invokeCount == maxCount) @@ -60,7 +60,7 @@ public void CheckStatus(Object stateInfo) } // The example displays output like the following: // 11:59:54.202 Creating timer. -// +// // 11:59:55.217 Checking status 1. // 11:59:55.466 Checking status 2. // 11:59:55.716 Checking status 3. @@ -71,9 +71,9 @@ public void CheckStatus(Object stateInfo) // 11:59:56.972 Checking status 8. // 11:59:57.223 Checking status 9. // 11:59:57.473 Checking status 10. -// +// // Changing period to .5 seconds. -// +// // 11:59:57.474 Checking status 1. // 11:59:57.976 Checking status 2. // 11:59:58.476 Checking status 3. @@ -84,6 +84,6 @@ public void CheckStatus(Object stateInfo) // 12:00:00.980 Checking status 8. // 12:00:01.481 Checking status 9. // 12:00:01.981 Checking status 10. -// +// // Destroying timer. // \ No newline at end of file diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.TimeZone2.Concepts/CS/TimeZone2Concepts.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.TimeZone2.Concepts/CS/TimeZone2Concepts.cs index 97275a03d1180..2c8d7a2cce486 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.TimeZone2.Concepts/CS/TimeZone2Concepts.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.TimeZone2.Concepts/CS/TimeZone2Concepts.cs @@ -1,5 +1,5 @@ // Note that this source code file includes a code module (modMain) and -// a WinForm. +// a WinForm. using System; using System.Collections.ObjectModel; @@ -26,7 +26,7 @@ public static void Main() Console.WriteLine("\nConvertUtcToCentral:"); tze.ConvertUtcToCentral(); Console.WriteLine("\nConvertHawaiianToLocal:"); - tze.ConvertHawaiianToLocal(); + tze.ConvertHawaiianToLocal(); Console.WriteLine("Resolving ambiguous times:"); Console.WriteLine(tze.ResolveAmbiguousTime(new DateTime(2006, 10, 29, 02, 03, 15))); Console.WriteLine(tze.ResolveAmbiguousTime(DateTime.Now)); @@ -40,12 +40,12 @@ private void IterateTimeZones() ReadOnlyCollection tzCollection; tzCollection = TimeZoneInfo.GetSystemTimeZones(); // - + Console.WriteLine("Listing {0} time zones found on the system:", tzCollection.Count); // foreach (TimeZoneInfo timeZone in tzCollection) Console.WriteLine(" {0}: {1}", timeZone.Id, timeZone.DisplayName); - // + // } private void SelectTimeZone() @@ -59,8 +59,8 @@ private void ShowDaylightStatus() // DateTime dateToday = DateTime.Now; TimeSpan differenceFromUtc = TimeZoneInfo.Local.GetUtcOffset(dateToday); - Console.WriteLine("The time is {0:t} in {1} time, {2:##.0} hours {3} universal time.", - dateToday, + Console.WriteLine("The time is {0:t} in {1} time, {2:##.0} hours {3} universal time.", + dateToday, TimeZoneInfo.Local.IsDaylightSavingTime(dateToday) ? "daylight saving" : "standard", Math.Abs(differenceFromUtc.TotalHours), differenceFromUtc.Hours > 0 ? "after" : "earlier than"); @@ -71,13 +71,13 @@ private void ShowLocalAndUtcTime() { // DateTime timeNow = DateTime.Now; - Console.WriteLine("It is now {0:t} {1}, or {2:t} {3}.", - timeNow, + Console.WriteLine("It is now {0:t} {1}, or {2:t} {3}.", + timeNow, TimeZoneInfo.Local.IsDaylightSavingTime(timeNow) ? - TimeZoneInfo.Local.DaylightName : TimeZoneInfo.Local.StandardName, - TimeZoneInfo.ConvertTime(timeNow, TimeZoneInfo.Local, TimeZoneInfo.Utc), - TimeZoneInfo.Utc.StandardName); - // + TimeZoneInfo.Local.DaylightName : TimeZoneInfo.Local.StandardName, + TimeZoneInfo.ConvertTime(timeNow, TimeZoneInfo.Local, TimeZoneInfo.Utc), + TimeZoneInfo.Utc.StandardName); + // } private void ConvertToArbitraryTime() @@ -87,16 +87,16 @@ private void ConvertToArbitraryTime() try { TimeZoneInfo easternZone = TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time"); - DateTime easternTimeNow = TimeZoneInfo.ConvertTime(timeNow, TimeZoneInfo.Local, + DateTime easternTimeNow = TimeZoneInfo.ConvertTime(timeNow, TimeZoneInfo.Local, easternZone); Console.WriteLine("{0} {1} corresponds to {2} {3}.", - timeNow, + timeNow, TimeZoneInfo.Local.IsDaylightSavingTime(timeNow) ? - TimeZoneInfo.Local.DaylightName : + TimeZoneInfo.Local.DaylightName : TimeZoneInfo.Local.StandardName, - easternTimeNow, + easternTimeNow, easternZone.IsDaylightSavingTime(easternTimeNow) ? - easternZone.DaylightName : + easternZone.DaylightName : easternZone.StandardName); } // Handle exception @@ -108,7 +108,7 @@ private void ConvertToArbitraryTime() catch (TimeZoneNotFoundException) { Console.WriteLine("The Eastern Standard Time Zone cannot be found on the local system."); - } + } catch (InvalidTimeZoneException) { Console.WriteLine("The Eastern Standard Time Zone contains invalid or missing data."); @@ -121,7 +121,7 @@ private void ConvertToArbitraryTime() { Console.WriteLine("Not enough memory is available to load information on the Eastern Standard Time zone."); } - // If we weren't passing FindSystemTimeZoneById a literal string, we also + // If we weren't passing FindSystemTimeZoneById a literal string, we also // would handle an ArgumentNullException. // } @@ -130,7 +130,7 @@ private void ConvertToUtc() { // DateTime dateNow = DateTime.Now; - Console.WriteLine("The date and time are {0} UTC.", + Console.WriteLine("The date and time are {0} UTC.", TimeZoneInfo.ConvertTimeToUtc(dateNow)); // } @@ -143,17 +143,17 @@ private void ConvertEasternToUtc() try { TimeZoneInfo easternZone = TimeZoneInfo.FindSystemTimeZoneById(easternZoneId); - Console.WriteLine("The date and time are {0} UTC.", + Console.WriteLine("The date and time are {0} UTC.", TimeZoneInfo.ConvertTimeToUtc(easternTime, easternZone)); } catch (TimeZoneNotFoundException) { - Console.WriteLine("Unable to find the {0} zone in the registry.", + Console.WriteLine("Unable to find the {0} zone in the registry.", easternZoneId); - } + } catch (InvalidTimeZoneException) { - Console.WriteLine("Registry data on the {0} zone has been corrupted.", + Console.WriteLine("Registry data on the {0} zone has been corrupted.", easternZoneId); } // @@ -167,15 +167,15 @@ private void ConvertUtcToCentral() { TimeZoneInfo cstZone = TimeZoneInfo.FindSystemTimeZoneById("Central Standard Time"); DateTime cstTime = TimeZoneInfo.ConvertTimeFromUtc(timeUtc, cstZone); - Console.WriteLine("The date and time are {0} {1}.", - cstTime, + Console.WriteLine("The date and time are {0} {1}.", + cstTime, cstZone.IsDaylightSavingTime(cstTime) ? cstZone.DaylightName : cstZone.StandardName); } catch (TimeZoneNotFoundException) { Console.WriteLine("The registry does not define the Central Standard Time zone."); - } + } catch (InvalidTimeZoneException) { Console.WriteLine("Registry data on the Central Standard Time zone has been corrupted."); @@ -190,15 +190,15 @@ private void ConvertHawaiianToLocal() try { TimeZoneInfo hwZone = TimeZoneInfo.FindSystemTimeZoneById("Hawaiian Standard Time"); - Console.WriteLine("{0} {1} is {2} local time.", - hwTime, - hwZone.IsDaylightSavingTime(hwTime) ? hwZone.DaylightName : hwZone.StandardName, + Console.WriteLine("{0} {1} is {2} local time.", + hwTime, + hwZone.IsDaylightSavingTime(hwTime) ? hwZone.DaylightName : hwZone.StandardName, TimeZoneInfo.ConvertTime(hwTime, hwZone, TimeZoneInfo.Local)); } catch (TimeZoneNotFoundException) { Console.WriteLine("The registry does not define the Hawaiian Standard Time zone."); - } + } catch (InvalidTimeZoneException) { Console.WriteLine("Registry data on the Hawaiian Standard Time zone has been corrupted."); @@ -212,32 +212,32 @@ private DateTime ResolveAmbiguousTime(DateTime ambiguousTime) { // Time is not ambiguous if (! TimeZoneInfo.Local.IsAmbiguousTime(ambiguousTime)) - { - return ambiguousTime; + { + return ambiguousTime; } // Time is ambiguous else { - DateTime utcTime = DateTime.SpecifyKind(ambiguousTime - TimeZoneInfo.Local.BaseUtcOffset, - DateTimeKind.Utc); - Console.WriteLine("{0} local time corresponds to {1} {2}.", + DateTime utcTime = DateTime.SpecifyKind(ambiguousTime - TimeZoneInfo.Local.BaseUtcOffset, + DateTimeKind.Utc); + Console.WriteLine("{0} local time corresponds to {1} {2}.", ambiguousTime, utcTime, utcTime.Kind.ToString()); - return utcTime; - } + return utcTime; + } } // - // Allow the user to resolve an ambiguous time + // Allow the user to resolve an ambiguous time // private void GetUserDateInput() { // Get date and time from user DateTime inputDate = GetUserDateTime(); DateTime utcDate; - + // Exit if date has no significant value if (inputDate == DateTime.MinValue) return; - + if (TimeZoneInfo.Local.IsAmbiguousTime(inputDate)) { Console.WriteLine("The date you've entered is ambiguous."); @@ -249,7 +249,7 @@ private void GetUserDateInput() } Console.Write("> "); int selection = Convert.ToInt32(Console.ReadLine()); - + // Convert local time to UTC, and set Kind property to DateTimeKind.Utc utcDate = DateTime.SpecifyKind(inputDate - offsets[selection], DateTimeKind.Utc); @@ -258,30 +258,30 @@ private void GetUserDateInput() else { utcDate = inputDate.ToUniversalTime(); - Console.WriteLine("{0} local time corresponds to {1} {2}.", inputDate, utcDate, utcDate.Kind.ToString()); + Console.WriteLine("{0} local time corresponds to {1} {2}.", inputDate, utcDate, utcDate.Kind.ToString()); } } - private DateTime GetUserDateTime() + private DateTime GetUserDateTime() { bool exitFlag = false; // flag to exit loop if date is valid - string dateString; + string dateString; DateTime inputDate = DateTime.MinValue; - + Console.Write("Enter a local date and time: "); while (! exitFlag) { dateString = Console.ReadLine(); if (dateString.ToUpper() == "E") exitFlag = true; - + if (DateTime.TryParse(dateString, out inputDate)) exitFlag = true; else Console.Write("Enter a valid date and time, or enter 'e' to exit: "); } - return inputDate; + return inputDate; } // } @@ -290,23 +290,23 @@ public class TZListForm : Form { private System.Windows.Forms.ListBox timeZoneList; private System.Windows.Forms.Button OkButton; - + public TZListForm() { this.timeZoneList = new System.Windows.Forms.ListBox(); this.OkButton = new System.Windows.Forms.Button(); this.SuspendLayout(); - // + // // timeZoneList - // + // this.timeZoneList.FormattingEnabled = true; this.timeZoneList.Location = new System.Drawing.Point(12, 12); this.timeZoneList.Name = "timeZoneList"; this.timeZoneList.Size = new System.Drawing.Size(250, 212); this.timeZoneList.TabIndex = 0; - // + // // OkButton - // + // this.OkButton.Location = new System.Drawing.Point(186, 231); this.OkButton.Name = "OkButton"; this.OkButton.Size = new System.Drawing.Size(75, 23); @@ -314,9 +314,9 @@ public TZListForm() this.OkButton.Text = "&OK"; this.OkButton.UseVisualStyleBackColor = true; this.OkButton.Click += new System.EventHandler(this.OkButton_Click); - // + // // Form1 - // + // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(292, 266); @@ -331,7 +331,7 @@ public TZListForm() // private void Form1_Load(object sender, EventArgs e) { - ReadOnlyCollection tzCollection; + ReadOnlyCollection tzCollection; tzCollection = TimeZoneInfo.GetSystemTimeZones(); this.timeZoneList.DataSource = tzCollection; } @@ -346,39 +346,39 @@ private void OkButton_Click(object sender, EventArgs e) private void ShowLocalAndUtc() { // - // Create Eastern Standard Time value and TimeZoneInfo object + // Create Eastern Standard Time value and TimeZoneInfo object DateTime estTime = new DateTime(2007, 1, 1, 00, 00, 00); string timeZoneName = "Eastern Standard Time"; try { TimeZoneInfo est = TimeZoneInfo.FindSystemTimeZoneById(timeZoneName); - + // Convert EST to local time DateTime localTime = TimeZoneInfo.ConvertTime(estTime, est, TimeZoneInfo.Local); - Console.WriteLine("At {0} {1}, the local time is {2} {3}.", - estTime, - est, - localTime, + Console.WriteLine("At {0} {1}, the local time is {2} {3}.", + estTime, + est, + localTime, TimeZoneInfo.Local.IsDaylightSavingTime(localTime) ? - TimeZoneInfo.Local.DaylightName : + TimeZoneInfo.Local.DaylightName : TimeZoneInfo.Local.StandardName); - + // Convert EST to UTC DateTime utcTime = TimeZoneInfo.ConvertTime(estTime, est, TimeZoneInfo.Utc); - Console.WriteLine("At {0} {1}, the time is {2} {3}.", - estTime, - est, - utcTime, + Console.WriteLine("At {0} {1}, the time is {2} {3}.", + estTime, + est, + utcTime, TimeZoneInfo.Utc.StandardName); } catch (TimeZoneNotFoundException) { - Console.WriteLine("The {0} zone cannot be found in the registry.", + Console.WriteLine("The {0} zone cannot be found in the registry.", timeZoneName); } catch (InvalidTimeZoneException) { - Console.WriteLine("The registry contains invalid data for the {0} zone.", + Console.WriteLine("The registry contains invalid data for the {0} zone.", timeZoneName); } // diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.TimeZone2.CreateTimeZone/cs/System.TimeZone2.CreateTimeZone.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.TimeZone2.CreateTimeZone/cs/System.TimeZone2.CreateTimeZone.cs index eadcdecca0244..4ead01dc5d6f4 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.TimeZone2.CreateTimeZone/cs/System.TimeZone2.CreateTimeZone.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.TimeZone2.CreateTimeZone/cs/System.TimeZone2.CreateTimeZone.cs @@ -33,50 +33,50 @@ private void TestCST() TimeZoneInfo est = TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time"); DateTime pastDate1 = new DateTime(1942, 2, 11); - Console.WriteLine("Is {0} daylight saving time: {1}", pastDate1, + Console.WriteLine("Is {0} daylight saving time: {1}", pastDate1, cst.IsDaylightSavingTime(pastDate1)); - + DateTime pastDate2 = new DateTime(1967, 10, 29, 1, 30, 00); - Console.WriteLine("Is {0} ambiguous: {1}", pastDate2, + Console.WriteLine("Is {0} ambiguous: {1}", pastDate2, cst.IsAmbiguousTime(pastDate2)); DateTime pastDate3 = new DateTime(1974, 1, 7, 2, 59, 00); - Console.WriteLine("{0} {1} is {2} {3}", pastDate3, - est.IsDaylightSavingTime(pastDate3) ? - est.DaylightName : est.StandardName, - TimeZoneInfo.ConvertTime(pastDate3, est, cst), + Console.WriteLine("{0} {1} is {2} {3}", pastDate3, + est.IsDaylightSavingTime(pastDate3) ? + est.DaylightName : est.StandardName, + TimeZoneInfo.ConvertTime(pastDate3, est, cst), cst.IsDaylightSavingTime(TimeZoneInfo.ConvertTime(pastDate3, est, cst)) ? cst.DaylightName : cst.StandardName); // // This code produces the following output to the console: - // + // // Is 2/11/1942 12:00:00 AM daylight saving time: True // Is 10/29/1967 1:30:00 AM ambiguous: True - // 1/7/1974 2:59:00 AM Eastern Standard Time is 1/7/1974 2:59:00 AM Central Daylight Time + // 1/7/1974 2:59:00 AM Eastern Standard Time is 1/7/1974 2:59:00 AM Central Daylight Time // - } + } private void DefineMawsonTime() { // string displayName = "(GMT+06:00) Antarctica/Mawson Time"; - string standardName = "Mawson Time"; + string standardName = "Mawson Time"; TimeSpan offset = new TimeSpan(06, 00, 00); TimeZoneInfo mawson = TimeZoneInfo.CreateCustomTimeZone(standardName, offset, displayName, standardName); - Console.WriteLine("The current time is {0} {1}", + Console.WriteLine("The current time is {0} {1}", TimeZoneInfo.ConvertTime(DateTime.Now, TimeZoneInfo.Local, mawson), - mawson.StandardName); + mawson.StandardName); // - } - + } + private void DefinePalmerTime() - { + { // // Define transition times to/from DST TimeZoneInfo.TransitionTime startTransition, endTransition; - startTransition = TimeZoneInfo.TransitionTime.CreateFloatingDateRule(new DateTime(1, 1, 1, 4, 0, 0), - 10, 2, DayOfWeek.Sunday); - endTransition = TimeZoneInfo.TransitionTime.CreateFloatingDateRule(new DateTime(1, 1, 1, 3, 0, 0), + startTransition = TimeZoneInfo.TransitionTime.CreateFloatingDateRule(new DateTime(1, 1, 1, 4, 0, 0), + 10, 2, DayOfWeek.Sunday); + endTransition = TimeZoneInfo.TransitionTime.CreateFloatingDateRule(new DateTime(1, 1, 1, 3, 0, 0), 3, 2, DayOfWeek.Sunday); // Define adjustment rule TimeSpan delta = new TimeSpan(1, 0, 0); @@ -90,8 +90,8 @@ private void DefinePalmerTime() string daylightName = "Palmer Daylight Time"; TimeSpan offset = new TimeSpan(-4, 0, 0); TimeZoneInfo palmer = TimeZoneInfo.CreateCustomTimeZone(standardName, offset, displayName, standardName, daylightName, adjustments); - Console.WriteLine("The current time is {0} {1}", - TimeZoneInfo.ConvertTime(DateTime.Now, TimeZoneInfo.Local, palmer), + Console.WriteLine("The current time is {0} {1}", + TimeZoneInfo.ConvertTime(DateTime.Now, TimeZoneInfo.Local, palmer), palmer.StandardName); // } @@ -102,12 +102,12 @@ private void DefineNonDSTTime() // Define transition times to/from DST TimeZoneInfo.TransitionTime startTransition, endTransition; startTransition = TimeZoneInfo.TransitionTime.CreateFloatingDateRule(new DateTime(1, 1, 1, 4, 0, 0), - 10, 2, DayOfWeek.Sunday); - endTransition = TimeZoneInfo.TransitionTime.CreateFloatingDateRule(new DateTime(1, 1, 1,3, 0, 0), + 10, 2, DayOfWeek.Sunday); + endTransition = TimeZoneInfo.TransitionTime.CreateFloatingDateRule(new DateTime(1, 1, 1,3, 0, 0), 3, 2, DayOfWeek.Sunday); // Define adjustment rule TimeSpan delta = new TimeSpan(1, 0, 0); - TimeZoneInfo.AdjustmentRule adjustment = TimeZoneInfo.AdjustmentRule.CreateAdjustmentRule(new DateTime(1999, 10, 1), + TimeZoneInfo.AdjustmentRule adjustment = TimeZoneInfo.AdjustmentRule.CreateAdjustmentRule(new DateTime(1999, 10, 1), DateTime.MaxValue.Date, delta, startTransition, endTransition); // Create array for adjustment rules TimeZoneInfo.AdjustmentRule[] adjustments = {adjustment}; @@ -117,19 +117,19 @@ private void DefineNonDSTTime() string daylightName = "Palmer Daylight Time"; TimeSpan offset = new TimeSpan(-4, 0, 0); // Create custom time zone without copying DST information - TimeZoneInfo palmer = TimeZoneInfo.CreateCustomTimeZone(standardName, offset, displayName, standardName, + TimeZoneInfo palmer = TimeZoneInfo.CreateCustomTimeZone(standardName, offset, displayName, standardName, daylightName, adjustments, true); // Indicate whether new time zone//s adjustment rules are present - Console.WriteLine("{0} {1}has {2} adjustment rules.", - palmer.StandardName, - ! (string.IsNullOrEmpty(palmer.DaylightName)) ? "(" + palmer.DaylightName + ") ": "" , + Console.WriteLine("{0} {1}has {2} adjustment rules.", + palmer.StandardName, + ! (string.IsNullOrEmpty(palmer.DaylightName)) ? "(" + palmer.DaylightName + ") ": "" , palmer.GetAdjustmentRules().Length); // Indicate whether new time zone supports DST Console.WriteLine("{0} supports DST: {1}", palmer.StandardName, palmer.SupportsDaylightSavingTime); // } - // + // private TimeZoneInfo InitializeTimeZone() { TimeZoneInfo southPole = null; @@ -143,7 +143,7 @@ private TimeZoneInfo InitializeTimeZone() { const string filename = @".\TimeZoneInfo.txt"; bool found = false; - + if (File.Exists(filename)) { StreamReader reader = new StreamReader(filename); @@ -157,13 +157,13 @@ private TimeZoneInfo InitializeTimeZone() reader.Close(); found = true; break; - } + } } } 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); + TimeZoneInfo.TransitionTime startTransition = TimeZoneInfo.TransitionTime.CreateFloatingDateRule(new DateTime(1, 1, 1, 2, 0, 0), 10, 1, DayOfWeek.Sunday); TimeZoneInfo.TransitionTime endTransition = TimeZoneInfo.TransitionTime.CreateFloatingDateRule(new DateTime(1, 1, 1, 2, 0, 0), 3, 3, DayOfWeek.Sunday); // Define adjustment rule TimeSpan delta = new TimeSpan(1, 0, 0); @@ -186,7 +186,7 @@ private TimeZoneInfo InitializeTimeZone() } // - private TimeZoneInfo CreateNewCentralStandardTimeZone() + private TimeZoneInfo CreateNewCentralStandardTimeZone() { // TimeZoneInfo cst; @@ -196,67 +196,67 @@ private TimeZoneInfo CreateNewCentralStandardTimeZone() List adjustmentList = new List(); // Declare transition time variables to hold transition time information TimeZoneInfo.TransitionTime transitionRuleStart, transitionRuleEnd; - + // Define new Central Standard Time zone 6 hours earlier than UTC // Define rule 1 (for 1918-1919) transitionRuleStart = TimeZoneInfo.TransitionTime.CreateFloatingDateRule(new DateTime(1, 1, 1, 2, 0, 0), 03, 05, DayOfWeek.Sunday); - transitionRuleEnd = TimeZoneInfo.TransitionTime.CreateFloatingDateRule(new DateTime(1, 1, 1, 2, 0, 0), 10, 05, DayOfWeek.Sunday); - adjustment = TimeZoneInfo.AdjustmentRule.CreateAdjustmentRule(new DateTime(1918, 1, 1), new DateTime(1919, 12, 31), delta, + transitionRuleEnd = TimeZoneInfo.TransitionTime.CreateFloatingDateRule(new DateTime(1, 1, 1, 2, 0, 0), 10, 05, DayOfWeek.Sunday); + adjustment = TimeZoneInfo.AdjustmentRule.CreateAdjustmentRule(new DateTime(1918, 1, 1), new DateTime(1919, 12, 31), delta, transitionRuleStart, transitionRuleEnd); - adjustmentList.Add(adjustment); + adjustmentList.Add(adjustment); // Define rule 2 (for 1942) transitionRuleStart = TimeZoneInfo.TransitionTime.CreateFixedDateRule(new DateTime(1, 1, 1, 2, 0, 0), 02, 09); - adjustment = TimeZoneInfo.AdjustmentRule.CreateAdjustmentRule(new DateTime(1942, 1, 1), new DateTime(1942, 12, 31), + adjustment = TimeZoneInfo.AdjustmentRule.CreateAdjustmentRule(new DateTime(1942, 1, 1), new DateTime(1942, 12, 31), delta, transitionRuleStart, transitionRuleEnd); adjustmentList.Add(adjustment); // Define rule 3 (for 1945) transitionRuleStart = TimeZoneInfo.TransitionTime.CreateFixedDateRule(new DateTime(1, 1, 1, 23, 0, 0), 08, 14); transitionRuleEnd = TimeZoneInfo.TransitionTime.CreateFixedDateRule(new DateTime(1, 1, 1, 2, 0, 0), 09, 30); - adjustment = TimeZoneInfo.AdjustmentRule.CreateAdjustmentRule(new DateTime(1945, 1, 1), new DateTime(1945, 12, 31), + adjustment = TimeZoneInfo.AdjustmentRule.CreateAdjustmentRule(new DateTime(1945, 1, 1), new DateTime(1945, 12, 31), delta, transitionRuleStart, transitionRuleEnd); adjustmentList.Add(adjustment); // Define end rule (for 1967-2006) transitionRuleEnd = TimeZoneInfo.TransitionTime.CreateFloatingDateRule(new DateTime(1, 1, 1, 2, 0, 0), 10, 5, DayOfWeek.Sunday); // Define rule 4 (for 1967-73) transitionRuleStart = TimeZoneInfo.TransitionTime.CreateFloatingDateRule(new DateTime(1, 1, 1, 2, 0, 0), 04, 05, DayOfWeek.Sunday); - adjustment = TimeZoneInfo.AdjustmentRule.CreateAdjustmentRule(new DateTime(1967, 1, 1), new DateTime(1973, 12, 31), + adjustment = TimeZoneInfo.AdjustmentRule.CreateAdjustmentRule(new DateTime(1967, 1, 1), new DateTime(1973, 12, 31), delta, transitionRuleStart, transitionRuleEnd); adjustmentList.Add(adjustment); // Define rule 5 (for 1974 only) transitionRuleStart = TimeZoneInfo.TransitionTime.CreateFixedDateRule(new DateTime(1, 1, 1, 2, 0, 0), 01, 06); - adjustment = TimeZoneInfo.AdjustmentRule.CreateAdjustmentRule(new DateTime(1974, 1, 1), new DateTime(1974, 12, 31), + adjustment = TimeZoneInfo.AdjustmentRule.CreateAdjustmentRule(new DateTime(1974, 1, 1), new DateTime(1974, 12, 31), delta, transitionRuleStart, transitionRuleEnd); adjustmentList.Add(adjustment); // Define rule 6 (for 1975 only) transitionRuleStart = TimeZoneInfo.TransitionTime.CreateFixedDateRule(new DateTime(1, 1, 1, 2, 0, 0), 02, 23); - adjustment = TimeZoneInfo.AdjustmentRule.CreateAdjustmentRule(new DateTime(1975, 1, 1), new DateTime(1975, 12, 31), + adjustment = TimeZoneInfo.AdjustmentRule.CreateAdjustmentRule(new DateTime(1975, 1, 1), new DateTime(1975, 12, 31), delta, transitionRuleStart, transitionRuleEnd); adjustmentList.Add(adjustment); // Define rule 7 (1976-1986) transitionRuleStart = TimeZoneInfo.TransitionTime.CreateFloatingDateRule(new DateTime(1, 1, 1, 2, 0, 0), 04, 05, DayOfWeek.Sunday); - adjustment = TimeZoneInfo.AdjustmentRule.CreateAdjustmentRule(new DateTime(1976, 1, 1), new DateTime(1986, 12, 31), + adjustment = TimeZoneInfo.AdjustmentRule.CreateAdjustmentRule(new DateTime(1976, 1, 1), new DateTime(1986, 12, 31), delta, transitionRuleStart, transitionRuleEnd); adjustmentList.Add(adjustment); - // Define rule 8 (1987-2006) + // Define rule 8 (1987-2006) transitionRuleStart = TimeZoneInfo.TransitionTime.CreateFloatingDateRule(new DateTime(1, 1, 1, 2, 0, 0), 04, 01, DayOfWeek.Sunday); - adjustment = TimeZoneInfo.AdjustmentRule.CreateAdjustmentRule(new DateTime(1987, 1, 1), new DateTime(2006, 12, 31), + adjustment = TimeZoneInfo.AdjustmentRule.CreateAdjustmentRule(new DateTime(1987, 1, 1), new DateTime(2006, 12, 31), delta, transitionRuleStart, transitionRuleEnd); adjustmentList.Add(adjustment); - // Define rule 9 (2007- ) + // Define rule 9 (2007- ) transitionRuleStart = TimeZoneInfo.TransitionTime.CreateFloatingDateRule(new DateTime(1, 1, 1, 2, 0, 0), 03, 02, DayOfWeek.Sunday); transitionRuleEnd = TimeZoneInfo.TransitionTime.CreateFloatingDateRule(new DateTime(1, 1, 1, 2, 0, 0), 11, 01, DayOfWeek.Sunday); - adjustment = TimeZoneInfo.AdjustmentRule.CreateAdjustmentRule(new DateTime(2007, 1, 1), DateTime.MaxValue.Date, + adjustment = TimeZoneInfo.AdjustmentRule.CreateAdjustmentRule(new DateTime(2007, 1, 1), DateTime.MaxValue.Date, delta, transitionRuleStart, transitionRuleEnd); adjustmentList.Add(adjustment); - + // Convert list of adjustment rules to an array TimeZoneInfo.AdjustmentRule[] adjustments = new TimeZoneInfo.AdjustmentRule[adjustmentList.Count]; adjustmentList.CopyTo(adjustments); - - cst = TimeZoneInfo.CreateCustomTimeZone("Central Standard Time", new TimeSpan(-6, 0, 0), - "(GMT-06:00) Central Time (US Only)", "Central Standard Time", + + cst = TimeZoneInfo.CreateCustomTimeZone("Central Standard Time", new TimeSpan(-6, 0, 0), + "(GMT-06:00) Central Time (US Only)", "Central Standard Time", "Central Daylight Time", adjustments); - // - return cst; + // + return cst; } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.TimeZone2.Serialization.1/cs/Serialization.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.TimeZone2.Serialization.1/cs/Serialization.cs index 841b2354061c0..e822a93c6c560 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.TimeZone2.Serialization.1/cs/Serialization.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.TimeZone2.Serialization.1/cs/Serialization.cs @@ -4,7 +4,7 @@ public class TimeZoneSerialization { static string serializedEst; - + public static void Main() { // Retrieve Eastern Standard Time zone from registry @@ -25,34 +25,34 @@ public static void Main() catch (InvalidTimeZoneException) { Console.WriteLine("Data on the Eastern Standard Time Zone in the registry is corrupted."); - } + } } private static void CreateTimeZone() { - // Create a simple Eastern Standard time zone + // Create a simple Eastern Standard time zone // without adjustment rules for 1883-1918 - TimeZoneInfo earlyEstZone = TimeZoneInfo.CreateCustomTimeZone("Eastern Standard Time", - new TimeSpan(-5, 0, 0), - " (GMT-05:00) Eastern Time (United States)", + TimeZoneInfo earlyEstZone = TimeZoneInfo.CreateCustomTimeZone("Eastern Standard Time", + new TimeSpan(-5, 0, 0), + " (GMT-05:00) Eastern Time (United States)", "Eastern Standard Time"); - serializedEst = earlyEstZone.ToSerializedString(); + serializedEst = earlyEstZone.ToSerializedString(); } - - private static DateTime ConvertUtcTime(DateTime utcDate, TimeZoneInfo tz) + + private static DateTime ConvertUtcTime(DateTime utcDate, TimeZoneInfo tz) { - // Use time zone object from registry + // Use time zone object from registry if (utcDate.Year > 1917) { return TimeZoneInfo.ConvertTimeFromUtc(utcDate, tz); - } + } // Handle dates before introduction of DST else { // Restore serialized time zone object tz = TimeZoneInfo.FromSerializedString(serializedEst); return TimeZoneInfo.ConvertTimeFromUtc(utcDate, tz); - } + } } } // diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.TimeZone2.Serialization.2/cs/Serialization2.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.TimeZone2.Serialization.2/cs/Serialization2.cs index ef84fd48f0276..9f0e81d0ca02c 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.TimeZone2.Serialization.2/cs/Serialization2.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.TimeZone2.Serialization.2/cs/Serialization2.cs @@ -7,10 +7,10 @@ public class TimeZoneApplication // Define collection of custom time zones private Dictionary customTimeZones = new Dictionary(); private TimeZoneInfo cst; - + public TimeZoneApplication() { - // Create custom Central Standard Time + // Create custom Central Standard Time // // Declare necessary TimeZoneInfo.AdjustmentRule objects for time zone TimeZoneInfo customTimeZone; @@ -26,25 +26,25 @@ public TimeZoneApplication() transitionRuleStart = TimeZoneInfo.TransitionTime.CreateFloatingDateRule(new DateTime(1, 1, 1, 2, 0, 0), 04, 05, DayOfWeek.Sunday); adjustment = TimeZoneInfo.AdjustmentRule.CreateAdjustmentRule(new DateTime(1976, 1, 1), new DateTime(1986, 12, 31), delta, transitionRuleStart, transitionRuleEnd); adjustmentList.Add(adjustment); - // Define rule (1987-2006) + // Define rule (1987-2006) transitionRuleStart = TimeZoneInfo.TransitionTime.CreateFloatingDateRule(new DateTime(1, 1, 1, 2, 0, 0), 04, 01, DayOfWeek.Sunday); adjustment = TimeZoneInfo.AdjustmentRule.CreateAdjustmentRule(new DateTime(1987, 1, 1), new DateTime(2006, 12, 31), delta, transitionRuleStart, transitionRuleEnd); adjustmentList.Add(adjustment); - // Define rule (2007- ) + // Define rule (2007- ) transitionRuleStart = TimeZoneInfo.TransitionTime.CreateFloatingDateRule(new DateTime(1, 1, 1, 2, 0, 0), 03, 02, DayOfWeek.Sunday); transitionRuleEnd = TimeZoneInfo.TransitionTime.CreateFloatingDateRule(new DateTime(1, 1, 1, 2, 0, 0), 11, 01, DayOfWeek.Sunday); adjustment = TimeZoneInfo.AdjustmentRule.CreateAdjustmentRule(new DateTime(2007, 01, 01), DateTime.MaxValue.Date, delta, transitionRuleStart, transitionRuleEnd); adjustmentList.Add(adjustment); - - // Create custom U.S. Central Standard Time zone - customTimeZone = TimeZoneInfo.CreateCustomTimeZone("Central Standard Time", - new TimeSpan(-6, 0, 0), - "(GMT-06:00) Central Time (US Only)", "Central Standard Time", - "Central Daylight Time", adjustmentList.ToArray()); + + // Create custom U.S. Central Standard Time zone + customTimeZone = TimeZoneInfo.CreateCustomTimeZone("Central Standard Time", + new TimeSpan(-6, 0, 0), + "(GMT-06:00) Central Time (US Only)", "Central Standard Time", + "Central Daylight Time", adjustmentList.ToArray()); // Add time zone to collection - customTimeZones.Add(customTimeZone.Id, customTimeZone.ToSerializedString()); + customTimeZones.Add(customTimeZone.Id, customTimeZone.ToSerializedString()); - // Create any other required time zones + // Create any other required time zones } public static void Main() @@ -52,13 +52,13 @@ public static void Main() TimeZoneApplication tza = new TimeZoneApplication(); tza.AppEntryPoint(); } - + private void AppEntryPoint() { try { cst = TimeZoneInfo.FindSystemTimeZoneById("Central Standard Time"); - } + } catch (TimeZoneNotFoundException) { if (customTimeZones.ContainsKey("Central Standard Time")) @@ -68,22 +68,22 @@ private void AppEntryPoint() { if (customTimeZones.ContainsKey("Central Standard Time")) HandleTimeZoneException("Central Standard Time"); - } + } if (cst == null) { Console.WriteLine("Unable to load Central Standard Time zone."); return; } DateTime currentTime = DateTime.Now; - Console.WriteLine("The current {0} time is {1}.", - TimeZoneInfo.Local.IsDaylightSavingTime(currentTime) ? - TimeZoneInfo.Local.StandardName : - TimeZoneInfo.Local.DaylightName, + Console.WriteLine("The current {0} time is {1}.", + TimeZoneInfo.Local.IsDaylightSavingTime(currentTime) ? + TimeZoneInfo.Local.StandardName : + TimeZoneInfo.Local.DaylightName, currentTime.ToString("f")); - Console.WriteLine("The current {0} time is {1}.", - cst.IsDaylightSavingTime(currentTime) ? - cst.StandardName : - cst.DaylightName, + Console.WriteLine("The current {0} time is {1}.", + cst.IsDaylightSavingTime(currentTime) ? + cst.StandardName : + cst.DaylightName, TimeZoneInfo.ConvertTime(currentTime, TimeZoneInfo.Local, cst).ToString("f")); } diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.X.ToString-and-Culture/cs/xts.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.X.ToString-and-Culture/cs/xts.cs index 5b401c9f8a783..3526d6d7added 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.X.ToString-and-Culture/cs/xts.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.X.ToString-and-Culture/cs/xts.cs @@ -1,27 +1,27 @@ // This older code snippet replaced by a new one -// This code example demonstrates the ToString(String) and +// This code example demonstrates the ToString(String) and // ToString(String, IFormatProvider) methods for integral and -// floating-point numbers, in conjunction with the standard +// floating-point numbers, in conjunction with the standard // numeric format specifiers. -// This code example uses the System.Int32 integral type and -// the System.Double floating-point type, but would yield -// similar results for any of the numeric types. The integral -// numeric types are System.Byte, SByte, Int16, Int32, Int64, -// UInt16, UInt32, and UInt64. The floating-point numeric types +// This code example uses the System.Int32 integral type and +// the System.Double floating-point type, but would yield +// similar results for any of the numeric types. The integral +// numeric types are System.Byte, SByte, Int16, Int32, Int64, +// UInt16, UInt32, and UInt64. The floating-point numeric types // are Decimal, Single, and Double. -// +// // using System; // using System.Globalization; // using System.Threading; -// -// class Sample +// +// class Sample // { -// public static void Main() +// public static void Main() // { // // Format a negative integer or floating-point number in various ways. // int integralVal = -12345; // double floatingVal = -1234.567d; -// +// // string msgCurrency = "(C) Currency: . . . . . . "; // string msgDecimal = "(D) Decimal:. . . . . . . "; // string msgScientific = "(E) Scientific: . . . . . "; @@ -31,41 +31,41 @@ // string msgPercent = "(P) Percent:. . . . . . . "; // string msgRoundTrip = "(R) Round-trip: . . . . . "; // string msgHexadecimal = "(X) Hexadecimal:. . . . . "; -// +// // string msg1 = "Use ToString(String) and the current thread culture.\n"; // string msg2 = "Use ToString(String, IFormatProvider) and a specified culture.\n"; // string msgCulture = "Culture:"; // string msgIntegralVal = "Integral value:"; // string msgFloatingVal = "Floating-point value:"; -// +// // CultureInfo ci; // // // Console.Clear(); // Console.WriteLine("Standard Numeric Format Specifiers:\n"); // // Display the values. // Console.WriteLine(msg1); -// +// // // Display the thread current culture, which is used to format the values. // ci = Thread.CurrentThread.CurrentCulture; // Console.WriteLine("{0,-26}{1}", msgCulture, ci.DisplayName); -// +// // // Display the integral and floating-point values. // Console.WriteLine("{0,-26}{1}", msgIntegralVal, integralVal); // Console.WriteLine("{0,-26}{1}", msgFloatingVal, floatingVal); // Console.WriteLine(); -// +// // // Use the format specifiers that are only for integral types. // Console.WriteLine("Format specifiers only for integral types:"); // Console.WriteLine(msgDecimal + integralVal.ToString("D")); // Console.WriteLine(msgHexadecimal + integralVal.ToString("X")); // Console.WriteLine(); -// -// // Use the format specifier that is only for the Single and Double +// +// // Use the format specifier that is only for the Single and Double // // floating-point types. // Console.WriteLine("Format specifier only for the Single and Double types:"); // Console.WriteLine(msgRoundTrip + floatingVal.ToString("R")); // Console.WriteLine(); -// +// // // Use the format specifiers that are for integral or floating-point types. // Console.WriteLine("Format specifiers for integral or floating-point types:"); // Console.WriteLine(msgCurrency + floatingVal.ToString("C")); @@ -75,36 +75,36 @@ // Console.WriteLine(msgNumber + floatingVal.ToString("N")); // Console.WriteLine(msgPercent + floatingVal.ToString("P")); // Console.WriteLine(); -// -// // Display the same values using a CultureInfo object. The CultureInfo class +// +// // Display the same values using a CultureInfo object. The CultureInfo class // // implements IFormatProvider. // Console.WriteLine(msg2); -// -// // Display the culture used to format the values. -// // Create a European culture and change its currency symbol to "euro" because -// // this particular code example uses a thread current UI culture that cannot +// +// // Display the culture used to format the values. +// // Create a European culture and change its currency symbol to "euro" because +// // this particular code example uses a thread current UI culture that cannot // // display the euro symbol (€). // ci = new CultureInfo("de-DE"); // ci.NumberFormat.CurrencySymbol = "euro"; // Console.WriteLine("{0,-26}{1}", msgCulture, ci.DisplayName); -// +// // // Display the integral and floating-point values. // Console.WriteLine("{0,-26}{1}", msgIntegralVal, integralVal); // Console.WriteLine("{0,-26}{1}", msgFloatingVal, floatingVal); // Console.WriteLine(); -// +// // // Use the format specifiers that are only for integral types. // Console.WriteLine("Format specifiers only for integral types:"); // Console.WriteLine(msgDecimal + integralVal.ToString("D", ci)); // Console.WriteLine(msgHexadecimal + integralVal.ToString("X", ci)); // Console.WriteLine(); -// -// // Use the format specifier that is only for the Single and Double +// +// // Use the format specifier that is only for the Single and Double // // floating-point types. // Console.WriteLine("Format specifier only for the Single and Double types:"); // Console.WriteLine(msgRoundTrip + floatingVal.ToString("R", ci)); // Console.WriteLine(); -// +// // // Use the format specifiers that are for integral or floating-point types. // Console.WriteLine("Format specifiers for integral or floating-point types:"); // Console.WriteLine(msgCurrency + floatingVal.ToString("C", ci)); @@ -118,22 +118,22 @@ // } // /* // This code example produces the following results: -// +// // Standard Numeric Format Specifiers: -// +// // Use ToString(String) and the current thread culture. -// +// // Culture: English (United States) // Integral value: -12345 // Floating-point value: -1234.567 -// +// // Format specifiers only for integral types: // (D) Decimal:. . . . . . . -12345 // (X) Hexadecimal:. . . . . FFFFCFC7 -// +// // Format specifier only for the Single and Double types: // (R) Round-trip: . . . . . -1234.567 -// +// // Format specifiers for integral or floating-point types: // (C) Currency: . . . . . . ($1,234.57) // (E) Scientific: . . . . . -1.234567E+003 @@ -141,20 +141,20 @@ // (G) General (default):. . -1234.567 // (N) Number: . . . . . . . -1,234.57 // (P) Percent:. . . . . . . -123,456.70 % -// +// // Use ToString(String, IFormatProvider) and a specified culture. -// +// // Culture: German (Germany) // Integral value: -12345 // Floating-point value: -1234.567 -// +// // Format specifiers only for integral types: // (D) Decimal:. . . . . . . -12345 // (X) Hexadecimal:. . . . . FFFFCFC7 -// +// // Format specifier only for the Single and Double types: // (R) Round-trip: . . . . . -1234,567 -// +// // Format specifiers for integral or floating-point types: // (C) Currency: . . . . . . -1.234,57 euro // (E) Scientific: . . . . . -1,234567E+003 @@ -162,7 +162,7 @@ // (G) General (default):. . -1234,567 // (N) Number: . . . . . . . -1.234,57 // (P) Percent:. . . . . . . -123.456,70% -// +// // */ // // END OF OLD CODE SNIPPET @@ -179,42 +179,42 @@ public static void Main() // // Display string representations of numbers for en-us culture CultureInfo ci = new CultureInfo("en-us"); - + // Output floating point values double floating = 10761.937554; - Console.WriteLine("C: {0}", + Console.WriteLine("C: {0}", floating.ToString("C", ci)); // Displays "C: $10,761.94" - Console.WriteLine("E: {0}", + Console.WriteLine("E: {0}", floating.ToString("E03", ci)); // Displays "E: 1.076E+004" - Console.WriteLine("F: {0}", - floating.ToString("F04", ci)); // Displays "F: 10761.9376" - Console.WriteLine("G: {0}", + Console.WriteLine("F: {0}", + floating.ToString("F04", ci)); // Displays "F: 10761.9376" + Console.WriteLine("G: {0}", floating.ToString("G", ci)); // Displays "G: 10761.937554" - Console.WriteLine("N: {0}", + Console.WriteLine("N: {0}", floating.ToString("N03", ci)); // Displays "N: 10,761.938" - Console.WriteLine("P: {0}", + Console.WriteLine("P: {0}", (floating/10000).ToString("P02", ci)); // Displays "P: 107.62 %" - Console.WriteLine("R: {0}", - floating.ToString("R", ci)); // Displays "R: 10761.937554" + Console.WriteLine("R: {0}", + floating.ToString("R", ci)); // Displays "R: 10761.937554" Console.WriteLine(); - + // Output integral values int integral = 8395; - Console.WriteLine("C: {0}", + Console.WriteLine("C: {0}", integral.ToString("C", ci)); // Displays "C: $8,395.00" - Console.WriteLine("D: {0}", - integral.ToString("D6", ci)); // Displays "D: 008395" - Console.WriteLine("E: {0}", + Console.WriteLine("D: {0}", + integral.ToString("D6", ci)); // Displays "D: 008395" + Console.WriteLine("E: {0}", integral.ToString("E03", ci)); // Displays "E: 8.395E+003" - Console.WriteLine("F: {0}", - integral.ToString("F01", ci)); // Displays "F: 8395.0" - Console.WriteLine("G: {0}", + Console.WriteLine("F: {0}", + integral.ToString("F01", ci)); // Displays "F: 8395.0" + Console.WriteLine("G: {0}", integral.ToString("G", ci)); // Displays "G: 8395" - Console.WriteLine("N: {0}", + Console.WriteLine("N: {0}", integral.ToString("N01", ci)); // Displays "N: 8,395.0" - Console.WriteLine("P: {0}", + Console.WriteLine("P: {0}", (integral/10000.0).ToString("P02", ci)); // Displays "P: 83.95 %" - Console.WriteLine("X: 0x{0}", + Console.WriteLine("X: 0x{0}", integral.ToString("X", ci)); // Displays "X: 0x20CB" Console.WriteLine(); // diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.appdomain.firstchanceexception/cs/example.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.appdomain.firstchanceexception/cs/example.cs index d0f211c518111..62286c9bb6f3d 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.appdomain.firstchanceexception/cs/example.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.appdomain.firstchanceexception/cs/example.cs @@ -29,7 +29,7 @@ static void Main() } catch (ArgumentException ex) { - Console.WriteLine("ArgumentException caught in {0}: {1}", + Console.WriteLine("ArgumentException caught in {0}: {1}", AppDomain.CurrentDomain.FriendlyName, ex.Message); } } @@ -57,7 +57,7 @@ public void Initialize(int count, int max) // Create another application domain, until the maximum is reached. // Field w remains null in the last application domain, as a signal - // to TestException(). + // to TestException(). if (count < max) { int next = count + 1; @@ -85,7 +85,7 @@ public void TestException(bool handled) } catch (ArgumentException ex) { - Console.WriteLine("ArgumentException caught in {0}: {1}", + Console.WriteLine("ArgumentException caught in {0}: {1}", AppDomain.CurrentDomain.FriendlyName, ex.Message); } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.appdomain.firstchanceexception_howto/cs/example.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.appdomain.firstchanceexception_howto/cs/example.cs index 0ba2e5add9ed1..18288f974c827 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.appdomain.firstchanceexception_howto/cs/example.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.appdomain.firstchanceexception_howto/cs/example.cs @@ -7,7 +7,7 @@ class Example { static void Main() { - // To receive first chance notifications of exceptions in + // To receive first chance notifications of exceptions in // an application domain, handle the FirstChanceException // event in that application domain. // @@ -32,7 +32,7 @@ static void Main() } catch (ArgumentException ex) { - Console.WriteLine("ArgumentException caught in {0}: {1}", + Console.WriteLine("ArgumentException caught in {0}: {1}", AppDomain.CurrentDomain.FriendlyName, ex.Message); } // @@ -60,7 +60,7 @@ public void Thrower(bool catchException) } catch (ArgumentException ex) { - Console.WriteLine("ArgumentException caught in {0}: {1}", + Console.WriteLine("ArgumentException caught in {0}: {1}", AppDomain.CurrentDomain.FriendlyName, ex.Message); } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.appdomain.firstchanceexception_howto_simple/cs/example.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.appdomain.firstchanceexception_howto_simple/cs/example.cs index 2697b59a71b68..1677bd6176f15 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.appdomain.firstchanceexception_howto_simple/cs/example.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.appdomain.firstchanceexception_howto_simple/cs/example.cs @@ -7,7 +7,7 @@ class Example { static void Main() { - AppDomain.CurrentDomain.FirstChanceException += + AppDomain.CurrentDomain.FirstChanceException += (object source, FirstChanceExceptionEventArgs e) => { Console.WriteLine("FirstChanceException event raised in {0}: {1}", @@ -22,7 +22,7 @@ static void Main() } catch (ArgumentException ex) { - Console.WriteLine("ArgumentException caught in {0}: {1}", + Console.WriteLine("ArgumentException caught in {0}: {1}", AppDomain.CurrentDomain.FriendlyName, ex.Message); } // diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.collections.generic.list.sort/cs/program.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.collections.generic.list.sort/cs/program.cs index 23cafcee61215..f7edb4d55ac35 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.collections.generic.list.sort/cs/program.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.collections.generic.list.sort/cs/program.cs @@ -1,8 +1,8 @@ // using System; using System.Collections.Generic; -// Simple business object. A PartId is used to identify the type of part -// but the part name can change. +// Simple business object. A PartId is used to identify the type of part +// but the part name can change. public class Part : IEquatable , IComparable { public string PartName { get; set; } @@ -22,7 +22,7 @@ public override bool Equals(object obj) } public int SortByNameAscending(string name1, string name2) { - + return name1.CompareTo(name2); } @@ -32,7 +32,7 @@ public int CompareTo(Part comparePart) // A null value means that this object is greater. if (comparePart == null) return 1; - + else return this.PartId.CompareTo(comparePart.PartId); } @@ -63,7 +63,7 @@ public static void Main() parts.Add(new Part() { PartName = "banana seat", PartId = 1444 }); parts.Add(new Part() { PartName = "cassette", PartId = 1534 }); - // Write out the parts in the list. This will call the overridden + // Write out the parts in the list. This will call the overridden // ToString method in the Part class. Console.WriteLine("\nBefore sort:"); foreach (Part aPart in parts) @@ -71,8 +71,8 @@ public static void Main() Console.WriteLine(aPart); } - // Call Sort on the list. This will use the - // default comparer, which is the Compare method + // Call Sort on the list. This will use the + // default comparer, which is the Compare method // implemented on Part. parts.Sort(); @@ -81,9 +81,9 @@ public static void Main() { Console.WriteLine(aPart); } - - // This shows calling the Sort(Comparison(T) overload using - // an anonymous method for the Comparison delegate. + + // This shows calling the Sort(Comparison(T) overload using + // an anonymous method for the Comparison delegate. // This method treats null as the lesser of two values. parts.Sort(delegate(Part x, Part y) { @@ -98,9 +98,9 @@ public static void Main() { Console.WriteLine(aPart); } - + /* - + Before sort: ID: 1434 Name: regular seat ID: 1234 Name: crank arm diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.globalization.cultureinfo.class.async/cs/asyncculture1.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.globalization.cultureinfo.class.async/cs/asyncculture1.cs index c9c3a998d0168..ab30e3540948e 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.globalization.cultureinfo.class.async/cs/asyncculture1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.globalization.cultureinfo.class.async/cs/asyncculture1.cs @@ -10,7 +10,7 @@ public class Example { - + public static void Main() { decimal[] values = { 163025412.32m, 18905365.59m }; @@ -20,15 +20,15 @@ public static void Main() Thread.CurrentThread.ManagedThreadId); foreach (var value in values) output += String.Format("{0} ", value.ToString(formatString)); - + output += Environment.NewLine; return output; }; - - Console.WriteLine("The example is running on thread {0}", + + Console.WriteLine("The example is running on thread {0}", Thread.CurrentThread.ManagedThreadId); // Make the current culture different from the system culture. - Console.WriteLine("The current culture is {0}", + Console.WriteLine("The current culture is {0}", CultureInfo.CurrentCulture.Name); if (CultureInfo.CurrentCulture.Name == "fr-FR") Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US"); @@ -37,18 +37,18 @@ public static void Main() Console.WriteLine("Changed the current culture to {0}.\n", CultureInfo.CurrentCulture.Name); - + // Execute the delegate synchronously. Console.WriteLine("Executing the delegate synchronously:"); Console.WriteLine(formatDelegate()); - + // Call an async delegate to format the values using one format string. - Console.WriteLine("Executing a task asynchronously:"); + Console.WriteLine("Executing a task asynchronously:"); var t1 = Task.Run(formatDelegate); Console.WriteLine(t1.Result); - + Console.WriteLine("Executing a task synchronously:"); - var t2 = new Task(formatDelegate); + var t2 = new Task(formatDelegate); t2.RunSynchronously(); Console.WriteLine(t2.Result); } diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.globalization.cultureinfo.class.async/cs/asyncculture2.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.globalization.cultureinfo.class.async/cs/asyncculture2.cs index e87da9bdb2cda..5de64e3bbea51 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.globalization.cultureinfo.class.async/cs/asyncculture2.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.globalization.cultureinfo.class.async/cs/asyncculture2.cs @@ -16,15 +16,15 @@ public static void Main() Thread.CurrentThread.ManagedThreadId); foreach (var value in values) output += String.Format("{0} ", value.ToString(formatString)); - + output += Environment.NewLine; return output; }; - - Console.WriteLine("The example is running on thread {0}", + + Console.WriteLine("The example is running on thread {0}", Thread.CurrentThread.ManagedThreadId); // Make the current culture different from the system culture. - Console.WriteLine("The current culture is {0}", + Console.WriteLine("The current culture is {0}", CultureInfo.CurrentCulture.Name); if (CultureInfo.CurrentCulture.Name == "fr-FR") Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US"); @@ -33,18 +33,18 @@ public static void Main() Console.WriteLine("Changed the current culture to {0}.\n", CultureInfo.CurrentCulture.Name); - + // Execute the delegate synchronously. Console.WriteLine("Executing the delegate synchronously:"); Console.WriteLine(formatDelegate()); - + // Call an async delegate to format the values using one format string. - Console.WriteLine("Executing a task asynchronously:"); + Console.WriteLine("Executing a task asynchronously:"); var t1 = Task.Run(formatDelegate); Console.WriteLine(t1.Result); - + Console.WriteLine("Executing a task synchronously:"); - var t2 = new Task(formatDelegate); + var t2 = new Task(formatDelegate); t2.RunSynchronously(); Console.WriteLine(t2.Result); } @@ -53,15 +53,15 @@ public static void Main() // The example is running on thread 1 // The current culture is en-US // Changed the current culture to fr-FR. -// +// // Executing the delegate synchronously: // Formatting using the fr-FR culture on thread 1. // 163 025 412,32 € 18 905 365,59 € -// +// // Executing a task asynchronously: // Formatting using the en-US culture on thread 3. // $163,025,412.32 $18,905,365.59 -// +// // Executing a task synchronously: // Formatting using the fr-FR culture on thread 1. // 163 025 412,32 € 18 905 365,59 € diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.globalization.cultureinfo.class.async/cs/asyncculture3.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.globalization.cultureinfo.class.async/cs/asyncculture3.cs index d5be7e888839f..1f623a0db1251 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.globalization.cultureinfo.class.async/cs/asyncculture3.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.globalization.cultureinfo.class.async/cs/asyncculture3.cs @@ -16,15 +16,15 @@ public static void Main() Thread.CurrentThread.ManagedThreadId); foreach (var value in values) output += String.Format("{0} ", value.ToString(formatString)); - + output += Environment.NewLine; return output; }; - - Console.WriteLine("The example is running on thread {0}", + + Console.WriteLine("The example is running on thread {0}", Thread.CurrentThread.ManagedThreadId); // Make the current culture different from the system culture. - Console.WriteLine("The current culture is {0}", + Console.WriteLine("The current culture is {0}", CultureInfo.CurrentCulture.Name); if (CultureInfo.CurrentCulture.Name == "fr-FR") Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US"); @@ -34,18 +34,18 @@ public static void Main() Console.WriteLine("Changed the current culture to {0}.\n", CultureInfo.CurrentCulture.Name); CultureInfo.DefaultThreadCurrentCulture = CultureInfo.CurrentCulture; - + // Execute the delegate synchronously. Console.WriteLine("Executing the delegate synchronously:"); Console.WriteLine(formatDelegate()); - + // Call an async delegate to format the values using one format string. - Console.WriteLine("Executing a task asynchronously:"); + Console.WriteLine("Executing a task asynchronously:"); var t1 = Task.Run(formatDelegate); Console.WriteLine(t1.Result); - + Console.WriteLine("Executing a task synchronously:"); - var t2 = new Task(formatDelegate); + var t2 = new Task(formatDelegate); t2.RunSynchronously(); Console.WriteLine(t2.Result); } @@ -54,15 +54,15 @@ public static void Main() // The example is running on thread 1 // The current culture is en-US // Changed the current culture to fr-FR. -// +// // Executing the delegate synchronously: // Formatting using the fr-FR culture on thread 1. // 163 025 412,32 € 18 905 365,59 € -// +// // Executing a task asynchronously: // Formatting using the fr-FR culture on thread 3. // 163 025 412,32 € 18 905 365,59 € -// +// // Executing a task synchronously: // Formatting using the fr-FR culture on thread 1. // 163 025 412,32 € 18 905 365,59 € diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.globalization.cultureinfo.class.async/cs/asyncculture4.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.globalization.cultureinfo.class.async/cs/asyncculture4.cs index 601c6d6e3bde4..9fcc62bfad400 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.globalization.cultureinfo.class.async/cs/asyncculture4.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.globalization.cultureinfo.class.async/cs/asyncculture4.cs @@ -12,10 +12,10 @@ public class Example public static void Main() { string formatString = "C2"; - Console.WriteLine("The example is running on thread {0}", + Console.WriteLine("The example is running on thread {0}", Thread.CurrentThread.ManagedThreadId); // Make the current culture different from the system culture. - Console.WriteLine("The current culture is {0}", + Console.WriteLine("The current culture is {0}", CultureInfo.CurrentCulture.Name); if (CultureInfo.CurrentCulture.Name == "fr-FR") Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US"); @@ -24,24 +24,24 @@ public static void Main() Console.WriteLine("Changed the current culture to {0}.\n", CultureInfo.CurrentCulture.Name); - + // Call an async delegate to format the values using one format string. - Console.WriteLine("Executing a task asynchronously in the main appdomain:"); + Console.WriteLine("Executing a task asynchronously in the main appdomain:"); var t1 = Task.Run(() => { DataRetriever d = new DataRetriever(); return d.GetFormattedNumber(formatString); }); Console.WriteLine(t1.Result); - Console.WriteLine(); - + Console.WriteLine(); + Console.WriteLine("Executing a task synchronously in two appdomains:"); - var t2 = Task.Run(() => { Console.WriteLine("Thread {0} is running in app domain '{1}'", - Thread.CurrentThread.ManagedThreadId, + var t2 = Task.Run(() => { Console.WriteLine("Thread {0} is running in app domain '{1}'", + Thread.CurrentThread.ManagedThreadId, AppDomain.CurrentDomain.FriendlyName); AppDomain domain = AppDomain.CreateDomain("Domain2"); DataRetriever d = (DataRetriever) domain.CreateInstanceAndUnwrap(typeof(Example).Assembly.FullName, "DataRetriever"); - return d.GetFormattedNumber(formatString); - }); + return d.GetFormattedNumber(formatString); + }); Console.WriteLine(t2.Result); } } @@ -52,8 +52,8 @@ public string GetFormattedNumber(String format) { Thread thread = Thread.CurrentThread; Console.WriteLine("Current culture is {0}", thread.CurrentCulture); - Console.WriteLine("Thread {0} is running in app domain '{1}'", - thread.ManagedThreadId, + Console.WriteLine("Thread {0} is running in app domain '{1}'", + thread.ManagedThreadId, AppDomain.CurrentDomain.FriendlyName); Random rnd = new Random(); Double value = rnd.NextDouble() * 1000; @@ -64,12 +64,12 @@ public string GetFormattedNumber(String format) // The example is running on thread 1 // The current culture is en-US // Changed the current culture to fr-FR. -// +// // Executing a task asynchronously in a single appdomain: // Current culture is fr-FR // Thread 3 is running in app domain 'AsyncCulture4.exe' // 93,48 € -// +// // Executing a task synchronously in two appdomains: // Thread 4 is running in app domain 'AsyncCulture4.exe' // Current culture is fr-FR diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.globalization.textinfo.totitlecase/cs/totitlecase2.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.globalization.textinfo.totitlecase/cs/totitlecase2.cs index 93860b927b677..48d9e397f4e6f 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.globalization.textinfo.totitlecase/cs/totitlecase2.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.globalization.textinfo.totitlecase/cs/totitlecase2.cs @@ -9,7 +9,7 @@ public static void Main() string[] values = { "a tale of two cities", "gROWL to the rescue", "inside the US government", "sports and MLB baseball", "The Return of Sherlock Holmes", "UNICEF and children"}; - + TextInfo ti = CultureInfo.CurrentCulture.TextInfo; foreach (var value in values) Console.WriteLine("{0} --> {1}", value, ti.ToTitleCase(value)); diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.idisposable/cs/base1.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.idisposable/cs/base1.cs index 55993a041372a..a456b7d6fa3d0 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.idisposable/cs/base1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.idisposable/cs/base1.cs @@ -9,26 +9,26 @@ class BaseClass : IDisposable bool disposed = false; // Instantiate a SafeHandle instance. SafeHandle handle = new SafeFileHandle(IntPtr.Zero, true); - + // Public implementation of Dispose pattern callable by consumers. public void Dispose() - { + { Dispose(true); - GC.SuppressFinalize(this); + GC.SuppressFinalize(this); } - + // Protected implementation of Dispose pattern. protected virtual void Dispose(bool disposing) { if (disposed) - return; - + return; + if (disposing) { handle.Dispose(); // Free any other managed objects here. // } - + disposed = true; } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.idisposable/cs/base2.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.idisposable/cs/base2.cs index b4eb50b28785e..0abf2506626db 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.idisposable/cs/base2.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.idisposable/cs/base2.cs @@ -5,25 +5,25 @@ class BaseClass : IDisposable { // Flag: Has Dispose already been called? bool disposed = false; - + // Public implementation of Dispose pattern callable by consumers. public void Dispose() - { + { Dispose(true); - GC.SuppressFinalize(this); + GC.SuppressFinalize(this); } - + // Protected implementation of Dispose pattern. protected virtual void Dispose(bool disposing) { if (disposed) - return; - + return; + if (disposing) { // Free any other managed objects here. // } - + // Free any unmanaged objects here. // disposed = true; diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.idisposable/cs/calling1.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.idisposable/cs/calling1.cs index 8075ccede2c7f..6645cee6754e0 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.idisposable/cs/calling1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.idisposable/cs/calling1.cs @@ -7,13 +7,13 @@ public class WordCount { private String filename = String.Empty; private int nWords = 0; - private String pattern = @"\b\w+\b"; + private String pattern = @"\b\w+\b"; public WordCount(string filename) { if (! File.Exists(filename)) throw new FileNotFoundException("The file does not exist."); - + this.filename = filename; string txt = String.Empty; using (StreamReader sr = new StreamReader(filename)) { @@ -21,16 +21,16 @@ public WordCount(string filename) } nWords = Regex.Matches(txt, pattern).Count; } - + public string FullName { get { return filename; } } - + public string Name { get { return Path.GetFileName(filename); } } - - public int Count + + public int Count { get { return nWords; } } -} +} // public class Example @@ -38,7 +38,7 @@ public class Example public static void Main() { WordCount wc = new WordCount(@"C:\users\ronpet\documents\Fr_Mike_Mass.txt"); - Console.WriteLine("File {0} ({1}) has {2} words", + Console.WriteLine("File {0} ({1}) has {2} words", wc.Name, wc.FullName, wc.Count); } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.idisposable/cs/calling2.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.idisposable/cs/calling2.cs index 8081e95a063ab..6d42603caae3a 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.idisposable/cs/calling2.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.idisposable/cs/calling2.cs @@ -7,13 +7,13 @@ public class WordCount { private String filename = String.Empty; private int nWords = 0; - private String pattern = @"\b\w+\b"; + private String pattern = @"\b\w+\b"; public WordCount(string filename) { if (! File.Exists(filename)) throw new FileNotFoundException("The file does not exist."); - + this.filename = filename; string txt = String.Empty; StreamReader sr = null; @@ -22,20 +22,20 @@ public WordCount(string filename) txt = sr.ReadToEnd(); } finally { - if (sr != null) sr.Dispose(); + if (sr != null) sr.Dispose(); } nWords = Regex.Matches(txt, pattern).Count; } - + public string FullName { get { return filename; } } - + public string Name { get { return Path.GetFileName(filename); } } - - public int Count + + public int Count { get { return nWords; } } -} +} // public class Example @@ -43,7 +43,7 @@ public class Example public static void Main() { WordCount wc = new WordCount(@"C:\users\ronpet\documents\Fr_Mike_Mass.txt"); - Console.WriteLine("File {0} ({1}) has {2} words", + Console.WriteLine("File {0} ({1}) has {2} words", wc.Name, wc.FullName, wc.Count); } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.idisposable/cs/derived1.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.idisposable/cs/derived1.cs index 7f5ea0e79d3be..10097818495dd 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.idisposable/cs/derived1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.idisposable/cs/derived1.cs @@ -14,14 +14,14 @@ class DerivedClass : BaseClass protected override void Dispose(bool disposing) { if (disposed) - return; - + return; + if (disposing) { handle.Dispose(); // Free any other managed objects here. // } - + // Free any unmanaged objects here. // @@ -36,25 +36,25 @@ class BaseClass : IDisposable { // Flag: Has Dispose already been called? bool disposed = false; - + // Public implementation of Dispose pattern callable by consumers. public void Dispose() - { + { Dispose(true); - GC.SuppressFinalize(this); + GC.SuppressFinalize(this); } - + // Protected implementation of Dispose pattern. protected virtual void Dispose(bool disposing) { if (disposed) - return; - + return; + if (disposing) { // Free any other managed objects here. // } - + // Free any unmanaged objects here. // disposed = true; diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.idisposable/cs/derived2.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.idisposable/cs/derived2.cs index d7d281ccc2183..b4011bc73393b 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.idisposable/cs/derived2.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.idisposable/cs/derived2.cs @@ -5,22 +5,22 @@ class DerivedClass : BaseClass { // Flag: Has Dispose already been called? bool disposed = false; - + // Protected implementation of Dispose pattern. protected override void Dispose(bool disposing) { if (disposed) - return; - + return; + if (disposing) { // Free any other managed objects here. // } - + // Free any unmanaged objects here. // disposed = true; - + // Call the base class implementation. base.Dispose(disposing); } @@ -36,25 +36,25 @@ class BaseClass : IDisposable { // Flag: Has Dispose already been called? bool disposed = false; - + // Public implementation of Dispose pattern callable by consumers. public void Dispose() - { + { Dispose(true); - GC.SuppressFinalize(this); + GC.SuppressFinalize(this); } - + // Protected implementation of Dispose pattern. protected virtual void Dispose(bool disposing) { if (disposed) - return; - + return; + if (disposing) { // Free any other managed objects here. // } - + // Free any unmanaged objects here. // disposed = true; diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.io.compression.ziparchive/cs/program1.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.io.compression.ziparchive/cs/program1.cs index 54f47e64c4625..8037753726792 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.io.compression.ziparchive/cs/program1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.io.compression.ziparchive/cs/program1.cs @@ -16,7 +16,7 @@ static void Main(string[] args) extractPath = Path.GetFullPath(extractPath); // Ensures that the last character on the extraction path - // is the directory separator char. + // is the directory separator char. // Without this, a malicious zip file could try to traverse outside of the expected // extraction path. if (!extractPath.EndsWith(Path.DirectorySeparatorChar.ToString(), StringComparison.Ordinal)) diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.io.compression.ziparchive/cs/program2.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.io.compression.ziparchive/cs/program2.cs index 7e8b45c605bcf..acb7d4a17c094 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.io.compression.ziparchive/cs/program2.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.io.compression.ziparchive/cs/program2.cs @@ -13,12 +13,12 @@ static void Main(string[] args) Console.WriteLine("Provide path where to extract the zip file:"); string extractPath = Console.ReadLine(); - + // Normalizes the path. extractPath = Path.GetFullPath(extractPath); // Ensures that the last character on the extraction path - // is the directory separator char. + // is the directory separator char. // Without this, a malicious zip file could try to traverse outside of the expected // extraction path. if (!extractPath.EndsWith(Path.DirectorySeparatorChar)) @@ -32,11 +32,11 @@ static void Main(string[] args) { // Gets the full path to ensure that relative segments are removed. string destinationPath = Path.GetFullPath(Path.Combine(extractPath, entry.FullName)); - + // Ordinal match is safest, case-sensitive volumes can be mounted within volumes that // are case-insensitive. if (destinationPath.StartsWith(extractPath, StringComparison.Ordinal)) - entry.ExtractToFile(destinationPath, true); + entry.ExtractToFile(destinationPath, true); } } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.io.compression.ziparchive/cs/program3.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.io.compression.ziparchive/cs/program3.cs index 0240bb2fe0979..1d8f07c8bc5a6 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.io.compression.ziparchive/cs/program3.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.io.compression.ziparchive/cs/program3.cs @@ -12,12 +12,12 @@ static void Main(string[] args) string zipPath = @"c:\users\exampleuser\start.zip"; string extractPath = @"c:\users\exampleuser\extract"; string newFile = @"c:\users\exampleuser\NewFile.txt"; - + using (ZipArchive archive = ZipFile.Open(zipPath, ZipArchiveMode.Update)) { archive.CreateEntryFromFile(newFile, "NewEntry.txt"); archive.ExtractToDirectory(extractPath); - } + } } } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.io.compression.ziparchive/cs/program4.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.io.compression.ziparchive/cs/program4.cs index f824e0cedf60e..29b21f3669319 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.io.compression.ziparchive/cs/program4.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.io.compression.ziparchive/cs/program4.cs @@ -12,12 +12,12 @@ static void Main(string[] args) string zipPath = @"c:\users\exampleuser\start.zip"; string extractPath = @"c:\users\exampleuser\extract"; string newFile = @"c:\users\exampleuser\NewFile.txt"; - + using (ZipArchive archive = ZipFile.Open(zipPath, ZipArchiveMode.Update)) { archive.CreateEntryFromFile(newFile, "NewEntry.txt", CompressionLevel.Fastest); archive.ExtractToDirectory(extractPath); - } + } } } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.io.directoryinfo.enumeratedirectories/cs/program.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.io.directoryinfo.enumeratedirectories/cs/program.cs index b487c064cd6e6..8f56f293e8fc0 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.io.directoryinfo.enumeratedirectories/cs/program.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.io.directoryinfo.enumeratedirectories/cs/program.cs @@ -28,7 +28,7 @@ static void Main(string[] args) Console.WriteLine($"{unAuthTop.Message}"); } } - + foreach (var di in diTop.EnumerateDirectories("*")) { try diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.io.enumdirs1/cs/program.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.io.enumdirs1/cs/program.cs index c6a0a439590b3..b7097e96d3b12 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.io.enumdirs1/cs/program.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.io.enumdirs1/cs/program.cs @@ -13,7 +13,7 @@ private static void Main(string[] args) string docPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); List dirs = new List(Directory.EnumerateDirectories(docPath)); - + foreach (var dir in dirs) { Console.WriteLine($"{dir.Substring(dir.LastIndexOf(Path.DirectorySeparatorChar) + 1)}"); diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.io.windowsruntimestorageextensions/cs/blankpage2.xaml.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.io.windowsruntimestorageextensions/cs/blankpage2.xaml.cs index 2fc494584a211..762af275fe480 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.io.windowsruntimestorageextensions/cs/blankpage2.xaml.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.io.windowsruntimestorageextensions/cs/blankpage2.xaml.cs @@ -27,7 +27,7 @@ private async void Button_Click_1(object sender, RoutedEventArgs e) using (StreamReader reader = new StreamReader( await ApplicationData.Current.LocalFolder.OpenStreamForReadAsync("testfile.txt"))) { - string contents = await reader.ReadToEndAsync(); + string contents = await reader.ReadToEndAsync(); DisplayContentsBlock.Text = contents; } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.io.windowsruntimestorageextensions/cs/blankpage3.xaml.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.io.windowsruntimestorageextensions/cs/blankpage3.xaml.cs index 9db96aa873c71..bde15678e9ba4 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.io.windowsruntimestorageextensions/cs/blankpage3.xaml.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.io.windowsruntimestorageextensions/cs/blankpage3.xaml.cs @@ -17,7 +17,7 @@ public BlankPage() private async void CreateButton_Click(object sender, RoutedEventArgs e) { StorageFile newFile = await ApplicationData.Current.LocalFolder.CreateFileAsync("testfile3.txt"); - + using (StreamWriter writer = new StreamWriter(await newFile.OpenStreamForWriteAsync())) { await writer.WriteLineAsync("new entry"); diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.io.windowsruntimestorageextensions/cs/blankpage4.xaml.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.io.windowsruntimestorageextensions/cs/blankpage4.xaml.cs index e9bad9c08fff7..35aae22a3365c 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.io.windowsruntimestorageextensions/cs/blankpage4.xaml.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.io.windowsruntimestorageextensions/cs/blankpage4.xaml.cs @@ -16,7 +16,7 @@ public BlankPage() private async void CreateButton_Click(object sender, RoutedEventArgs e) { - using (StreamWriter writer = + using (StreamWriter writer = new StreamWriter(await ApplicationData.Current.LocalFolder.OpenStreamForWriteAsync( "testfile.txt", CreationCollisionOption.OpenIfExists))) { diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.io.windowsruntimestreamextensionsex/cs/mainpage.xaml.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.io.windowsruntimestreamextensionsex/cs/mainpage.xaml.cs index 2f78a66246442..8606a45aa5197 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.io.windowsruntimestreamextensionsex/cs/mainpage.xaml.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.io.windowsruntimestreamextensionsex/cs/mainpage.xaml.cs @@ -42,7 +42,7 @@ private async void button1_Click(object sender, RoutedEventArgs e) // Retrieve the stream. This method returns a IRandomAccessStreamWithContentType. var stream = await result.OpenReadAsync(); - // Convert the stream to a .NET stream using AsStream, pass to a + // Convert the stream to a .NET stream using AsStream, pass to a // StreamReader and read the stream. using (StreamReader sr = new StreamReader(stream.AsStream())) { diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.io.windowsruntimestreamextensionsex/cs/mainpage1.xaml.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.io.windowsruntimestreamextensionsex/cs/mainpage1.xaml.cs index 8d8f65c5a000a..7540e49aa3792 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.io.windowsruntimestreamextensionsex/cs/mainpage1.xaml.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.io.windowsruntimestreamextensionsex/cs/mainpage1.xaml.cs @@ -29,7 +29,7 @@ private async void button1_Click(object sender, RoutedEventArgs e) // Retrieve the stream. This method returns a IRandomAccessStreamWithContentType. var stream = await result.OpenReadAsync(); - // Convert the stream to a .NET stream using AsStream, pass to a + // Convert the stream to a .NET stream using AsStream, pass to a // StreamReader and read the stream. using (StreamReader sr = new StreamReader(stream.AsStream())) { diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.reflectionwinstoreapp/cs/mainpage.xaml.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.reflectionwinstoreapp/cs/mainpage.xaml.cs index 75f63b8e406b5..b754e1f939c7a 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.reflectionwinstoreapp/cs/mainpage.xaml.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.reflectionwinstoreapp/cs/mainpage.xaml.cs @@ -27,7 +27,7 @@ protected override void OnNavigatedTo(NavigationEventArgs e) IEnumerable mList = t.DeclaredMethods; StringBuilder sb = new StringBuilder(); - + sb.Append("Properties:"); foreach (PropertyInfo p in pList) { @@ -39,7 +39,7 @@ protected override void OnNavigatedTo(NavigationEventArgs e) { sb.Append("\n" + m.DeclaringType.Name + ": " + m.Name); } - + textblock1.Text = sb.ToString(); } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.text.regularexpressions.regex.ctor/cs/ctor1.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.text.regularexpressions.regex.ctor/cs/ctor1.cs index 0a256dc47f2ac..663abed742da3 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.text.regularexpressions.regex.ctor/cs/ctor1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.text.regularexpressions.regex.ctor/cs/ctor1.cs @@ -4,7 +4,7 @@ using System.Diagnostics; using System.Security; using System.Text.RegularExpressions; -using System.Threading; +using System.Threading; public class Example { @@ -13,36 +13,36 @@ public class Example public static void Main() { string pattern = @"(a+)+$"; // DO NOT REUSE THIS PATTERN. - Regex rgx = new Regex(pattern, RegexOptions.IgnoreCase, TimeSpan.FromSeconds(1)); + Regex rgx = new Regex(pattern, RegexOptions.IgnoreCase, TimeSpan.FromSeconds(1)); Stopwatch sw = null; - - string[] inputs= { "aa", "aaaa>", + + string[] inputs= { "aa", "aaaa>", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaa>", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa>" }; - + foreach (var inputValue in inputs) { Console.WriteLine("Processing {0}", inputValue); bool timedOut = false; - do { + do { try { sw = Stopwatch.StartNew(); // Display the result. if (rgx.IsMatch(inputValue)) { sw.Stop(); - Console.WriteLine(@"Valid: '{0}' ({1:ss\.fffffff} seconds)", - inputValue, sw.Elapsed); + Console.WriteLine(@"Valid: '{0}' ({1:ss\.fffffff} seconds)", + inputValue, sw.Elapsed); } else { sw.Stop(); - Console.WriteLine(@"'{0}' is not a valid string. ({1:ss\.fffff} seconds)", + Console.WriteLine(@"'{0}' is not a valid string. ({1:ss\.fffff} seconds)", inputValue, sw.Elapsed); } } - catch (RegexMatchTimeoutException e) { + catch (RegexMatchTimeoutException e) { sw.Stop(); // Display the elapsed time until the exception. - Console.WriteLine(@"Timeout with '{0}' after {1:ss\.fffff}", + Console.WriteLine(@"Timeout with '{0}' after {1:ss\.fffff}", inputValue, sw.Elapsed); Thread.Sleep(1500); // Pause for 1.5 seconds. @@ -53,28 +53,28 @@ public static void Main() MaxTimeoutInSeconds); timedOut = false; } - else { - Console.WriteLine("Changing the timeout interval to {0}", - timeout); + else { + Console.WriteLine("Changing the timeout interval to {0}", + timeout); rgx = new Regex(pattern, RegexOptions.IgnoreCase, timeout); timedOut = true; } } } while (timedOut); Console.WriteLine(); - } + } } } // The example displays output like the following : // Processing aa // Valid: 'aa' (00.0000779 seconds) -// +// // Processing aaaa> // 'aaaa>' is not a valid string. (00.00005 seconds) -// +// // Processing aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa // Valid: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' (00.0000043 seconds) -// +// // Processing aaaaaaaaaaaaaaaaaaaaaa> // Timeout with 'aaaaaaaaaaaaaaaaaaaaaa>' after 01.00469 // Changing the timeout interval to 00:00:02 @@ -82,7 +82,7 @@ public static void Main() // Changing the timeout interval to 00:00:03 // Timeout with 'aaaaaaaaaaaaaaaaaaaaaa>' after 03.01043 // Maximum timeout interval of 3 seconds exceeded. -// +// // Processing aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa> // Timeout with 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa>' after 03.01018 // Maximum timeout interval of 3 seconds exceeded. diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.threading.tasks.parallel/cs/parallelforcancel.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.threading.tasks.parallel/cs/parallelforcancel.cs index 26a8f450c6a52..899de21fb2706 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.threading.tasks.parallel/cs/parallelforcancel.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.threading.tasks.parallel/cs/parallelforcancel.cs @@ -18,7 +18,7 @@ class ParallelForCancellation // An iteration for each argument value (0, 1, 2, 3, 4, 5, 6, 7, 8, 9) is executed. // The order of execution of the iterations is undefined. // The iteration when i=2 cancels the loop. - // Some iterations may bail out or not start at all; because they are temporally executed in unpredictable order, + // Some iterations may bail out or not start at all; because they are temporally executed in unpredictable order, // it is impossible to say which will start/complete and which won't. // At the end, an OperationCancelledException is surfaced. // Documentation: diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.threading.tasks.parallel/cs/parallelintro.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.threading.tasks.parallel/cs/parallelintro.cs index 34b0e1c95bf05..a3cfaffa9dc6d 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.threading.tasks.parallel/cs/parallelintro.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.threading.tasks.parallel/cs/parallelintro.cs @@ -1,5 +1,5 @@  // - using System.Threading.Tasks; + using System.Threading.Tasks; class Test { static int N = 1000; diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.threading.tasks.parallel/cs/threadlocalforwithoptions.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.threading.tasks.parallel/cs/threadlocalforwithoptions.cs index 7a1fb7ac62e1b..6195ad0e3eaf5 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.threading.tasks.parallel/cs/threadlocalforwithoptions.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.threading.tasks.parallel/cs/threadlocalforwithoptions.cs @@ -18,7 +18,7 @@ static void Main() // This example limits the degree of parallelism to four. // You might limit the degree of parallelism when your algorithm - // does not scale beyond a certain number of cores or when you + // does not scale beyond a certain number of cores or when you // enforce a particular quality of service in your application. Parallel.For(0, N, new ParallelOptions { MaxDegreeOfParallelism = 4 }, diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.uritowindowsuri/cs/mainpage.xaml.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.uritowindowsuri/cs/mainpage.xaml.cs index 39cef693305ee..49794af80eac1 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.uritowindowsuri/cs/mainpage.xaml.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.uritowindowsuri/cs/mainpage.xaml.cs @@ -15,7 +15,7 @@ namespace TestUri { - + public sealed partial class MainPage : Page { public MainPage() diff --git a/samples/snippets/csharp/VS_Snippets_Data/DLinqAdoNet/cs/Program.cs b/samples/snippets/csharp/VS_Snippets_Data/DLinqAdoNet/cs/Program.cs index a611d474c09c0..bd0abf5179c10 100644 --- a/samples/snippets/csharp/VS_Snippets_Data/DLinqAdoNet/cs/Program.cs +++ b/samples/snippets/csharp/VS_Snippets_Data/DLinqAdoNet/cs/Program.cs @@ -13,7 +13,7 @@ static void Main(string[] args) Northwnd db = new Northwnd(@""); // - db.Connection.Close(); + db.Connection.Close(); // // diff --git a/samples/snippets/csharp/VS_Snippets_Data/DLinqAdoNet/cs/northwind.cs b/samples/snippets/csharp/VS_Snippets_Data/DLinqAdoNet/cs/northwind.cs index 740a5d2cbbf59..ac4a6ea8edba3 100644 --- a/samples/snippets/csharp/VS_Snippets_Data/DLinqAdoNet/cs/northwind.cs +++ b/samples/snippets/csharp/VS_Snippets_Data/DLinqAdoNet/cs/northwind.cs @@ -73,25 +73,25 @@ static Northwnd() { } - public Northwnd(string connection) : + public Northwnd(string connection) : base(connection, mappingSource) { OnCreated(); } - public Northwnd(System.Data.IDbConnection connection) : + public Northwnd(System.Data.IDbConnection connection) : base(connection, mappingSource) { OnCreated(); } - public Northwnd(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) : + public Northwnd(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) : base(connection, mappingSource) { OnCreated(); } - public Northwnd(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : + public Northwnd(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : base(connection, mappingSource) { OnCreated(); @@ -504,7 +504,7 @@ public CustomerDemographic CustomerDemographic set { CustomerDemographic previousValue = this._CustomerDemographic.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._CustomerDemographic.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -538,7 +538,7 @@ public Customer Customer set { Customer previousValue = this._Customer.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Customer.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1536,7 +1536,7 @@ public Employee ReportsToEmployee set { Employee previousValue = this._ReportsToEmployee.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._ReportsToEmployee.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1751,7 +1751,7 @@ public Employee Employee set { Employee previousValue = this._Employee.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Employee.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1785,7 +1785,7 @@ public Territory Territory set { Territory previousValue = this._Territory.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Territory.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1991,7 +1991,7 @@ public Order Order set { Order previousValue = this._Order.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Order.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2025,7 +2025,7 @@ public Product Product set { Product previousValue = this._Product.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Product.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2470,7 +2470,7 @@ public Customer Customer set { Customer previousValue = this._Customer.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Customer.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2504,7 +2504,7 @@ public Employee Employee set { Employee previousValue = this._Employee.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Employee.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2538,7 +2538,7 @@ public Shipper Shipper set { Shipper previousValue = this._Shipper.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Shipper.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2894,7 +2894,7 @@ public Category Category set { Category previousValue = this._Category.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Category.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2928,7 +2928,7 @@ public Supplier Supplier set { Supplier previousValue = this._Supplier.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Supplier.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -3721,7 +3721,7 @@ public Region Region set { Region previousValue = this._Region.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Region.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); diff --git a/samples/snippets/csharp/VS_Snippets_Data/DLinqCRUDOps/cs/northwind.cs b/samples/snippets/csharp/VS_Snippets_Data/DLinqCRUDOps/cs/northwind.cs index 3f692f7ea35bc..1a7cfe67b61bf 100644 --- a/samples/snippets/csharp/VS_Snippets_Data/DLinqCRUDOps/cs/northwind.cs +++ b/samples/snippets/csharp/VS_Snippets_Data/DLinqCRUDOps/cs/northwind.cs @@ -73,25 +73,25 @@ static Northwnd() { } - public Northwnd(string connection) : + public Northwnd(string connection) : base(connection, mappingSource) { OnCreated(); } - public Northwnd(System.Data.IDbConnection connection) : + public Northwnd(System.Data.IDbConnection connection) : base(connection, mappingSource) { OnCreated(); } - public Northwnd(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) : + public Northwnd(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) : base(connection, mappingSource) { OnCreated(); } - public Northwnd(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : + public Northwnd(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : base(connection, mappingSource) { OnCreated(); @@ -504,7 +504,7 @@ public CustomerDemographic CustomerDemographic set { CustomerDemographic previousValue = this._CustomerDemographic.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._CustomerDemographic.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -538,7 +538,7 @@ public Customer Customer set { Customer previousValue = this._Customer.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Customer.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1536,7 +1536,7 @@ public Employee ReportsToEmployee set { Employee previousValue = this._ReportsToEmployee.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._ReportsToEmployee.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1751,7 +1751,7 @@ public Employee Employee set { Employee previousValue = this._Employee.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Employee.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1785,7 +1785,7 @@ public Territory Territory set { Territory previousValue = this._Territory.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Territory.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1991,7 +1991,7 @@ public Order Order set { Order previousValue = this._Order.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Order.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2025,7 +2025,7 @@ public Product Product set { Product previousValue = this._Product.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Product.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2470,7 +2470,7 @@ public Customer Customer set { Customer previousValue = this._Customer.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Customer.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2504,7 +2504,7 @@ public Employee Employee set { Employee previousValue = this._Employee.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Employee.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2538,7 +2538,7 @@ public Shipper Shipper set { Shipper previousValue = this._Shipper.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Shipper.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2894,7 +2894,7 @@ public Category Category set { Category previousValue = this._Category.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Category.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2928,7 +2928,7 @@ public Supplier Supplier set { Supplier previousValue = this._Supplier.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Supplier.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -3721,7 +3721,7 @@ public Region Region set { Region previousValue = this._Region.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Region.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); diff --git a/samples/snippets/csharp/VS_Snippets_Data/DLinqCascadeWorkaround/cs/northwind.cs b/samples/snippets/csharp/VS_Snippets_Data/DLinqCascadeWorkaround/cs/northwind.cs index dd681669e2a48..a13d59ebc58bc 100644 --- a/samples/snippets/csharp/VS_Snippets_Data/DLinqCascadeWorkaround/cs/northwind.cs +++ b/samples/snippets/csharp/VS_Snippets_Data/DLinqCascadeWorkaround/cs/northwind.cs @@ -70,25 +70,25 @@ public partial class Northwnd : System.Data.Linq.DataContext partial void DeleteTerritory(Territory instance); #endregion - public Northwnd(string connection) : + public Northwnd(string connection) : base(connection, mappingSource) { OnCreated(); } - public Northwnd(System.Data.IDbConnection connection) : + public Northwnd(System.Data.IDbConnection connection) : base(connection, mappingSource) { OnCreated(); } - public Northwnd(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) : + public Northwnd(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) : base(connection, mappingSource) { OnCreated(); } - public Northwnd(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : + public Northwnd(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : base(connection, mappingSource) { OnCreated(); @@ -499,7 +499,7 @@ public CustomerDemographic CustomerDemographic set { CustomerDemographic previousValue = this._CustomerDemographic.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._CustomerDemographic.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -533,7 +533,7 @@ public Customer Customer set { Customer previousValue = this._Customer.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Customer.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1525,7 +1525,7 @@ public Employee ReportsToEmployee set { Employee previousValue = this._ReportsToEmployee.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._ReportsToEmployee.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1734,7 +1734,7 @@ public Employee Employee set { Employee previousValue = this._Employee.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Employee.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1768,7 +1768,7 @@ public Territory Territory set { Territory previousValue = this._Territory.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Territory.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1974,7 +1974,7 @@ public Order Order set { Order previousValue = this._Order.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Order.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2008,7 +2008,7 @@ public Product Product set { Product previousValue = this._Product.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Product.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2453,7 +2453,7 @@ public Customer Customer set { Customer previousValue = this._Customer.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Customer.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2487,7 +2487,7 @@ public Employee Employee set { Employee previousValue = this._Employee.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Employee.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2521,7 +2521,7 @@ public Shipper Shipper set { Shipper previousValue = this._Shipper.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Shipper.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2875,7 +2875,7 @@ public Category Category set { Category previousValue = this._Category.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Category.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2909,7 +2909,7 @@ public Supplier Supplier set { Supplier previousValue = this._Supplier.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Supplier.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -3694,7 +3694,7 @@ public Region Region set { Region previousValue = this._Region.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Region.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); diff --git a/samples/snippets/csharp/VS_Snippets_Data/DLinqCommunicatingWithDatabase/cs/Program.cs b/samples/snippets/csharp/VS_Snippets_Data/DLinqCommunicatingWithDatabase/cs/Program.cs index f0f9548f3c1c4..e20465fdd1643 100644 --- a/samples/snippets/csharp/VS_Snippets_Data/DLinqCommunicatingWithDatabase/cs/Program.cs +++ b/samples/snippets/csharp/VS_Snippets_Data/DLinqCommunicatingWithDatabase/cs/Program.cs @@ -17,7 +17,7 @@ static void Main(string[] args) // Northwnd db = new Northwnd(@"c:\northwnd.mdf"); // -// DataContext takes a connection string. +// DataContext takes a connection string. DataContext db = new DataContext(@"c:\Northwind.mdf"); // Get a typed table to run queries. @@ -90,7 +90,7 @@ public Northwind(string connection) : base(connection) { } // void method() - { + { // Northwnd db = new Northwnd(@"c:\Northwnd.mdf"); var query = diff --git a/samples/snippets/csharp/VS_Snippets_Data/DLinqCommunicatingWithDatabase/cs/northwind.cs b/samples/snippets/csharp/VS_Snippets_Data/DLinqCommunicatingWithDatabase/cs/northwind.cs index d016fd1301dd5..200e69a56d8c5 100644 --- a/samples/snippets/csharp/VS_Snippets_Data/DLinqCommunicatingWithDatabase/cs/northwind.cs +++ b/samples/snippets/csharp/VS_Snippets_Data/DLinqCommunicatingWithDatabase/cs/northwind.cs @@ -73,25 +73,25 @@ static Northwnd() { } - public Northwnd(string connection) : + public Northwnd(string connection) : base(connection, mappingSource) { OnCreated(); } - public Northwnd(System.Data.IDbConnection connection) : + public Northwnd(System.Data.IDbConnection connection) : base(connection, mappingSource) { OnCreated(); } - public Northwnd(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) : + public Northwnd(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) : base(connection, mappingSource) { OnCreated(); } - public Northwnd(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : + public Northwnd(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : base(connection, mappingSource) { OnCreated(); @@ -504,7 +504,7 @@ public CustomerDemographic CustomerDemographic set { CustomerDemographic previousValue = this._CustomerDemographic.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._CustomerDemographic.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -538,7 +538,7 @@ public Customer Customer set { Customer previousValue = this._Customer.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Customer.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1536,7 +1536,7 @@ public Employee ReportsToEmployee set { Employee previousValue = this._ReportsToEmployee.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._ReportsToEmployee.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1751,7 +1751,7 @@ public Employee Employee set { Employee previousValue = this._Employee.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Employee.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1785,7 +1785,7 @@ public Territory Territory set { Territory previousValue = this._Territory.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Territory.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1991,7 +1991,7 @@ public Order Order set { Order previousValue = this._Order.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Order.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2025,7 +2025,7 @@ public Product Product set { Product previousValue = this._Product.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Product.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2474,7 +2474,7 @@ public Customer Customer set { Customer previousValue = this._Customer.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Customer.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2508,7 +2508,7 @@ public Employee Employee set { Employee previousValue = this._Employee.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Employee.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2542,7 +2542,7 @@ public Shipper Shipper set { Shipper previousValue = this._Shipper.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Shipper.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2898,7 +2898,7 @@ public Category Category set { Category previousValue = this._Category.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Category.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2932,7 +2932,7 @@ public Supplier Supplier set { Supplier previousValue = this._Supplier.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Supplier.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -3725,7 +3725,7 @@ public Region Region set { Region previousValue = this._Region.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Region.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); diff --git a/samples/snippets/csharp/VS_Snippets_Data/DLinqCompositeKeys/cs/northwind.cs b/samples/snippets/csharp/VS_Snippets_Data/DLinqCompositeKeys/cs/northwind.cs index 740a5d2cbbf59..ac4a6ea8edba3 100644 --- a/samples/snippets/csharp/VS_Snippets_Data/DLinqCompositeKeys/cs/northwind.cs +++ b/samples/snippets/csharp/VS_Snippets_Data/DLinqCompositeKeys/cs/northwind.cs @@ -73,25 +73,25 @@ static Northwnd() { } - public Northwnd(string connection) : + public Northwnd(string connection) : base(connection, mappingSource) { OnCreated(); } - public Northwnd(System.Data.IDbConnection connection) : + public Northwnd(System.Data.IDbConnection connection) : base(connection, mappingSource) { OnCreated(); } - public Northwnd(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) : + public Northwnd(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) : base(connection, mappingSource) { OnCreated(); } - public Northwnd(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : + public Northwnd(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : base(connection, mappingSource) { OnCreated(); @@ -504,7 +504,7 @@ public CustomerDemographic CustomerDemographic set { CustomerDemographic previousValue = this._CustomerDemographic.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._CustomerDemographic.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -538,7 +538,7 @@ public Customer Customer set { Customer previousValue = this._Customer.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Customer.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1536,7 +1536,7 @@ public Employee ReportsToEmployee set { Employee previousValue = this._ReportsToEmployee.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._ReportsToEmployee.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1751,7 +1751,7 @@ public Employee Employee set { Employee previousValue = this._Employee.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Employee.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1785,7 +1785,7 @@ public Territory Territory set { Territory previousValue = this._Territory.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Territory.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1991,7 +1991,7 @@ public Order Order set { Order previousValue = this._Order.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Order.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2025,7 +2025,7 @@ public Product Product set { Product previousValue = this._Product.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Product.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2470,7 +2470,7 @@ public Customer Customer set { Customer previousValue = this._Customer.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Customer.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2504,7 +2504,7 @@ public Employee Employee set { Employee previousValue = this._Employee.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Employee.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2538,7 +2538,7 @@ public Shipper Shipper set { Shipper previousValue = this._Shipper.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Shipper.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2894,7 +2894,7 @@ public Category Category set { Category previousValue = this._Category.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Category.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2928,7 +2928,7 @@ public Supplier Supplier set { Supplier previousValue = this._Supplier.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Supplier.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -3721,7 +3721,7 @@ public Region Region set { Region previousValue = this._Region.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Region.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); diff --git a/samples/snippets/csharp/VS_Snippets_Data/DLinqDataBinding/cs/northwind.cs b/samples/snippets/csharp/VS_Snippets_Data/DLinqDataBinding/cs/northwind.cs index 740a5d2cbbf59..ac4a6ea8edba3 100644 --- a/samples/snippets/csharp/VS_Snippets_Data/DLinqDataBinding/cs/northwind.cs +++ b/samples/snippets/csharp/VS_Snippets_Data/DLinqDataBinding/cs/northwind.cs @@ -73,25 +73,25 @@ static Northwnd() { } - public Northwnd(string connection) : + public Northwnd(string connection) : base(connection, mappingSource) { OnCreated(); } - public Northwnd(System.Data.IDbConnection connection) : + public Northwnd(System.Data.IDbConnection connection) : base(connection, mappingSource) { OnCreated(); } - public Northwnd(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) : + public Northwnd(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) : base(connection, mappingSource) { OnCreated(); } - public Northwnd(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : + public Northwnd(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : base(connection, mappingSource) { OnCreated(); @@ -504,7 +504,7 @@ public CustomerDemographic CustomerDemographic set { CustomerDemographic previousValue = this._CustomerDemographic.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._CustomerDemographic.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -538,7 +538,7 @@ public Customer Customer set { Customer previousValue = this._Customer.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Customer.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1536,7 +1536,7 @@ public Employee ReportsToEmployee set { Employee previousValue = this._ReportsToEmployee.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._ReportsToEmployee.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1751,7 +1751,7 @@ public Employee Employee set { Employee previousValue = this._Employee.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Employee.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1785,7 +1785,7 @@ public Territory Territory set { Territory previousValue = this._Territory.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Territory.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1991,7 +1991,7 @@ public Order Order set { Order previousValue = this._Order.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Order.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2025,7 +2025,7 @@ public Product Product set { Product previousValue = this._Product.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Product.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2470,7 +2470,7 @@ public Customer Customer set { Customer previousValue = this._Customer.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Customer.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2504,7 +2504,7 @@ public Employee Employee set { Employee previousValue = this._Employee.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Employee.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2538,7 +2538,7 @@ public Shipper Shipper set { Shipper previousValue = this._Shipper.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Shipper.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2894,7 +2894,7 @@ public Category Category set { Category previousValue = this._Category.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Category.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2928,7 +2928,7 @@ public Supplier Supplier set { Supplier previousValue = this._Supplier.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Supplier.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -3721,7 +3721,7 @@ public Region Region set { Region previousValue = this._Region.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Region.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); diff --git a/samples/snippets/csharp/VS_Snippets_Data/DLinqDebuggingSupport/cs/Program.cs b/samples/snippets/csharp/VS_Snippets_Data/DLinqDebuggingSupport/cs/Program.cs index b841fd6011633..cecd1c0e478d0 100644 --- a/samples/snippets/csharp/VS_Snippets_Data/DLinqDebuggingSupport/cs/Program.cs +++ b/samples/snippets/csharp/VS_Snippets_Data/DLinqDebuggingSupport/cs/Program.cs @@ -37,7 +37,7 @@ void method2() from cust in db.Customers where cust.City == "London" select cust; - + foreach (Customer custObj in custQuery) { Console.WriteLine("CustomerID: {0}", custObj.CustomerID); @@ -45,7 +45,7 @@ from cust in db.Customers custObj.City = "Paris"; Console.WriteLine("\tUpdated value: {0}", custObj.City); } - + ChangeSet cs = db.GetChangeSet(); Console.Write("Total changes: {0}", cs); // Freeze the console window. diff --git a/samples/snippets/csharp/VS_Snippets_Data/DLinqDebuggingSupport/cs/northwind.cs b/samples/snippets/csharp/VS_Snippets_Data/DLinqDebuggingSupport/cs/northwind.cs index 740a5d2cbbf59..ac4a6ea8edba3 100644 --- a/samples/snippets/csharp/VS_Snippets_Data/DLinqDebuggingSupport/cs/northwind.cs +++ b/samples/snippets/csharp/VS_Snippets_Data/DLinqDebuggingSupport/cs/northwind.cs @@ -73,25 +73,25 @@ static Northwnd() { } - public Northwnd(string connection) : + public Northwnd(string connection) : base(connection, mappingSource) { OnCreated(); } - public Northwnd(System.Data.IDbConnection connection) : + public Northwnd(System.Data.IDbConnection connection) : base(connection, mappingSource) { OnCreated(); } - public Northwnd(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) : + public Northwnd(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) : base(connection, mappingSource) { OnCreated(); } - public Northwnd(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : + public Northwnd(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : base(connection, mappingSource) { OnCreated(); @@ -504,7 +504,7 @@ public CustomerDemographic CustomerDemographic set { CustomerDemographic previousValue = this._CustomerDemographic.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._CustomerDemographic.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -538,7 +538,7 @@ public Customer Customer set { Customer previousValue = this._Customer.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Customer.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1536,7 +1536,7 @@ public Employee ReportsToEmployee set { Employee previousValue = this._ReportsToEmployee.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._ReportsToEmployee.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1751,7 +1751,7 @@ public Employee Employee set { Employee previousValue = this._Employee.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Employee.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1785,7 +1785,7 @@ public Territory Territory set { Territory previousValue = this._Territory.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Territory.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1991,7 +1991,7 @@ public Order Order set { Order previousValue = this._Order.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Order.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2025,7 +2025,7 @@ public Product Product set { Product previousValue = this._Product.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Product.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2470,7 +2470,7 @@ public Customer Customer set { Customer previousValue = this._Customer.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Customer.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2504,7 +2504,7 @@ public Employee Employee set { Employee previousValue = this._Employee.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Employee.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2538,7 +2538,7 @@ public Shipper Shipper set { Shipper previousValue = this._Shipper.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Shipper.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2894,7 +2894,7 @@ public Category Category set { Category previousValue = this._Category.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Category.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2928,7 +2928,7 @@ public Supplier Supplier set { Supplier previousValue = this._Supplier.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Supplier.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -3721,7 +3721,7 @@ public Region Region set { Region previousValue = this._Region.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Region.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); diff --git a/samples/snippets/csharp/VS_Snippets_Data/DLinqGettingStarted/cs/Program.cs b/samples/snippets/csharp/VS_Snippets_Data/DLinqGettingStarted/cs/Program.cs index e30c3e2521a45..b35dbd1ec4bcc 100644 --- a/samples/snippets/csharp/VS_Snippets_Data/DLinqGettingStarted/cs/Program.cs +++ b/samples/snippets/csharp/VS_Snippets_Data/DLinqGettingStarted/cs/Program.cs @@ -53,7 +53,7 @@ void method3() { // Northwnd nw = new Northwnd(@"northwnd.mdf"); - + var cityNameQuery = from cust in nw.Customers where cust.City.Contains("London") diff --git a/samples/snippets/csharp/VS_Snippets_Data/DLinqGettingStarted/cs/northwind.cs b/samples/snippets/csharp/VS_Snippets_Data/DLinqGettingStarted/cs/northwind.cs index 740a5d2cbbf59..ac4a6ea8edba3 100644 --- a/samples/snippets/csharp/VS_Snippets_Data/DLinqGettingStarted/cs/northwind.cs +++ b/samples/snippets/csharp/VS_Snippets_Data/DLinqGettingStarted/cs/northwind.cs @@ -73,25 +73,25 @@ static Northwnd() { } - public Northwnd(string connection) : + public Northwnd(string connection) : base(connection, mappingSource) { OnCreated(); } - public Northwnd(System.Data.IDbConnection connection) : + public Northwnd(System.Data.IDbConnection connection) : base(connection, mappingSource) { OnCreated(); } - public Northwnd(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) : + public Northwnd(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) : base(connection, mappingSource) { OnCreated(); } - public Northwnd(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : + public Northwnd(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : base(connection, mappingSource) { OnCreated(); @@ -504,7 +504,7 @@ public CustomerDemographic CustomerDemographic set { CustomerDemographic previousValue = this._CustomerDemographic.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._CustomerDemographic.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -538,7 +538,7 @@ public Customer Customer set { Customer previousValue = this._Customer.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Customer.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1536,7 +1536,7 @@ public Employee ReportsToEmployee set { Employee previousValue = this._ReportsToEmployee.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._ReportsToEmployee.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1751,7 +1751,7 @@ public Employee Employee set { Employee previousValue = this._Employee.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Employee.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1785,7 +1785,7 @@ public Territory Territory set { Territory previousValue = this._Territory.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Territory.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1991,7 +1991,7 @@ public Order Order set { Order previousValue = this._Order.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Order.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2025,7 +2025,7 @@ public Product Product set { Product previousValue = this._Product.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Product.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2470,7 +2470,7 @@ public Customer Customer set { Customer previousValue = this._Customer.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Customer.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2504,7 +2504,7 @@ public Employee Employee set { Employee previousValue = this._Employee.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Employee.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2538,7 +2538,7 @@ public Shipper Shipper set { Shipper previousValue = this._Shipper.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Shipper.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2894,7 +2894,7 @@ public Category Category set { Category previousValue = this._Category.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Category.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2928,7 +2928,7 @@ public Supplier Supplier set { Supplier previousValue = this._Supplier.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Supplier.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -3721,7 +3721,7 @@ public Region Region set { Region previousValue = this._Region.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Region.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); diff --git a/samples/snippets/csharp/VS_Snippets_Data/DLinqLocalMethodCall/cs/northwind.cs b/samples/snippets/csharp/VS_Snippets_Data/DLinqLocalMethodCall/cs/northwind.cs index 0b6802e8cab11..b80f0c7d403a8 100644 --- a/samples/snippets/csharp/VS_Snippets_Data/DLinqLocalMethodCall/cs/northwind.cs +++ b/samples/snippets/csharp/VS_Snippets_Data/DLinqLocalMethodCall/cs/northwind.cs @@ -73,25 +73,25 @@ static Northwnd() { } - public Northwnd(string connection) : + public Northwnd(string connection) : base(connection, mappingSource) { OnCreated(); } - public Northwnd(System.Data.IDbConnection connection) : + public Northwnd(System.Data.IDbConnection connection) : base(connection, mappingSource) { OnCreated(); } - public Northwnd(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) : + public Northwnd(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) : base(connection, mappingSource) { OnCreated(); } - public Northwnd(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : + public Northwnd(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : base(connection, mappingSource) { OnCreated(); @@ -504,7 +504,7 @@ public CustomerDemographic CustomerDemographic set { CustomerDemographic previousValue = this._CustomerDemographic.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._CustomerDemographic.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -538,7 +538,7 @@ public Customer Customer set { Customer previousValue = this._Customer.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Customer.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1536,7 +1536,7 @@ public Employee ReportsToEmployee set { Employee previousValue = this._ReportsToEmployee.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._ReportsToEmployee.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1751,7 +1751,7 @@ public Employee Employee set { Employee previousValue = this._Employee.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Employee.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1785,7 +1785,7 @@ public Territory Territory set { Territory previousValue = this._Territory.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Territory.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1991,7 +1991,7 @@ public Order Order set { Order previousValue = this._Order.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Order.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2025,7 +2025,7 @@ public Product Product set { Product previousValue = this._Product.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Product.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2080,7 +2080,7 @@ public int LocalInstanceMethod(int x) { return x + 1; } - + void q2() { var q2 = @@ -2489,7 +2489,7 @@ public Customer Customer set { Customer previousValue = this._Customer.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Customer.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2523,7 +2523,7 @@ public Employee Employee set { Employee previousValue = this._Employee.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Employee.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2557,7 +2557,7 @@ public Shipper Shipper set { Shipper previousValue = this._Shipper.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Shipper.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2913,7 +2913,7 @@ public Category Category set { Category previousValue = this._Category.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Category.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2947,7 +2947,7 @@ public Supplier Supplier set { Supplier previousValue = this._Supplier.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Supplier.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -3740,7 +3740,7 @@ public Region Region set { Region previousValue = this._Region.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Region.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); diff --git a/samples/snippets/csharp/VS_Snippets_Data/DLinqObjectIdentity/cs/Program.cs b/samples/snippets/csharp/VS_Snippets_Data/DLinqObjectIdentity/cs/Program.cs index 2f019c31b7a26..20b3d314bb200 100644 --- a/samples/snippets/csharp/VS_Snippets_Data/DLinqObjectIdentity/cs/Program.cs +++ b/samples/snippets/csharp/VS_Snippets_Data/DLinqObjectIdentity/cs/Program.cs @@ -26,9 +26,9 @@ static void Main(string[] args) void method2() { - + Northwnd db = new Northwnd(@"c:\northwnd.mdf"); - + // Customer cust1 = (from cust in db.Customers diff --git a/samples/snippets/csharp/VS_Snippets_Data/DLinqObjectIdentity/cs/northwind.cs b/samples/snippets/csharp/VS_Snippets_Data/DLinqObjectIdentity/cs/northwind.cs index 740a5d2cbbf59..ac4a6ea8edba3 100644 --- a/samples/snippets/csharp/VS_Snippets_Data/DLinqObjectIdentity/cs/northwind.cs +++ b/samples/snippets/csharp/VS_Snippets_Data/DLinqObjectIdentity/cs/northwind.cs @@ -73,25 +73,25 @@ static Northwnd() { } - public Northwnd(string connection) : + public Northwnd(string connection) : base(connection, mappingSource) { OnCreated(); } - public Northwnd(System.Data.IDbConnection connection) : + public Northwnd(System.Data.IDbConnection connection) : base(connection, mappingSource) { OnCreated(); } - public Northwnd(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) : + public Northwnd(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) : base(connection, mappingSource) { OnCreated(); } - public Northwnd(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : + public Northwnd(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : base(connection, mappingSource) { OnCreated(); @@ -504,7 +504,7 @@ public CustomerDemographic CustomerDemographic set { CustomerDemographic previousValue = this._CustomerDemographic.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._CustomerDemographic.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -538,7 +538,7 @@ public Customer Customer set { Customer previousValue = this._Customer.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Customer.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1536,7 +1536,7 @@ public Employee ReportsToEmployee set { Employee previousValue = this._ReportsToEmployee.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._ReportsToEmployee.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1751,7 +1751,7 @@ public Employee Employee set { Employee previousValue = this._Employee.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Employee.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1785,7 +1785,7 @@ public Territory Territory set { Territory previousValue = this._Territory.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Territory.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1991,7 +1991,7 @@ public Order Order set { Order previousValue = this._Order.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Order.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2025,7 +2025,7 @@ public Product Product set { Product previousValue = this._Product.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Product.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2470,7 +2470,7 @@ public Customer Customer set { Customer previousValue = this._Customer.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Customer.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2504,7 +2504,7 @@ public Employee Employee set { Employee previousValue = this._Employee.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Employee.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2538,7 +2538,7 @@ public Shipper Shipper set { Shipper previousValue = this._Shipper.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Shipper.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2894,7 +2894,7 @@ public Category Category set { Category previousValue = this._Category.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Category.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2928,7 +2928,7 @@ public Supplier Supplier set { Supplier previousValue = this._Supplier.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Supplier.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -3721,7 +3721,7 @@ public Region Region set { Region previousValue = this._Region.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Region.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); diff --git a/samples/snippets/csharp/VS_Snippets_Data/DLinqObjectModel/cs/northwind.cs b/samples/snippets/csharp/VS_Snippets_Data/DLinqObjectModel/cs/northwind.cs index e27314ddc054b..10cf53e47d15d 100644 --- a/samples/snippets/csharp/VS_Snippets_Data/DLinqObjectModel/cs/northwind.cs +++ b/samples/snippets/csharp/VS_Snippets_Data/DLinqObjectModel/cs/northwind.cs @@ -73,25 +73,25 @@ static Northwnd() { } - public Northwnd(string connection) : + public Northwnd(string connection) : base(connection, mappingSource) { OnCreated(); } - public Northwnd(System.Data.IDbConnection connection) : + public Northwnd(System.Data.IDbConnection connection) : base(connection, mappingSource) { OnCreated(); } - public Northwnd(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) : + public Northwnd(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) : base(connection, mappingSource) { OnCreated(); } - public Northwnd(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : + public Northwnd(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : base(connection, mappingSource) { OnCreated(); @@ -507,7 +507,7 @@ public CustomerDemographic CustomerDemographic set { CustomerDemographic previousValue = this._CustomerDemographic.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._CustomerDemographic.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -541,7 +541,7 @@ public Customer Customer set { Customer previousValue = this._Customer.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Customer.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1539,7 +1539,7 @@ public Employee ReportsToEmployee set { Employee previousValue = this._ReportsToEmployee.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._ReportsToEmployee.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1754,7 +1754,7 @@ public Employee Employee set { Employee previousValue = this._Employee.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Employee.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1788,7 +1788,7 @@ public Territory Territory set { Territory previousValue = this._Territory.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Territory.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1994,7 +1994,7 @@ public Order Order set { Order previousValue = this._Order.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Order.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2028,7 +2028,7 @@ public Product Product set { Product previousValue = this._Product.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Product.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2474,7 +2474,7 @@ public Customer Customer set { Customer previousValue = this._Customer.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Customer.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2509,7 +2509,7 @@ public Employee Employee set { Employee previousValue = this._Employee.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Employee.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2543,7 +2543,7 @@ public Shipper Shipper set { Shipper previousValue = this._Shipper.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Shipper.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2899,7 +2899,7 @@ public Category Category set { Category previousValue = this._Category.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Category.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2933,7 +2933,7 @@ public Supplier Supplier set { Supplier previousValue = this._Supplier.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Supplier.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -3726,7 +3726,7 @@ public Region Region set { Region previousValue = this._Region.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Region.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); diff --git a/samples/snippets/csharp/VS_Snippets_Data/DLinqOverrideDefault/cs/northwind.cs b/samples/snippets/csharp/VS_Snippets_Data/DLinqOverrideDefault/cs/northwind.cs index a789d8ef0f650..7c407e877f0cd 100644 --- a/samples/snippets/csharp/VS_Snippets_Data/DLinqOverrideDefault/cs/northwind.cs +++ b/samples/snippets/csharp/VS_Snippets_Data/DLinqOverrideDefault/cs/northwind.cs @@ -142,25 +142,25 @@ static Northwnd() { } - public Northwnd(string connection) : + public Northwnd(string connection) : base(connection, mappingSource) { OnCreated(); } - public Northwnd(System.Data.IDbConnection connection) : + public Northwnd(System.Data.IDbConnection connection) : base(connection, mappingSource) { OnCreated(); } - public Northwnd(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) : + public Northwnd(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) : base(connection, mappingSource) { OnCreated(); } - public Northwnd(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : + public Northwnd(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : base(connection, mappingSource) { OnCreated(); @@ -573,7 +573,7 @@ public CustomerDemographic CustomerDemographic set { CustomerDemographic previousValue = this._CustomerDemographic.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._CustomerDemographic.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -607,7 +607,7 @@ public Customer Customer set { Customer previousValue = this._Customer.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Customer.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1607,7 +1607,7 @@ public Employee ReportsToEmployee set { Employee previousValue = this._ReportsToEmployee.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._ReportsToEmployee.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1822,7 +1822,7 @@ public Employee Employee set { Employee previousValue = this._Employee.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Employee.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1856,7 +1856,7 @@ public Territory Territory set { Territory previousValue = this._Territory.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Territory.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2062,7 +2062,7 @@ public Order Order set { Order previousValue = this._Order.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Order.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2096,7 +2096,7 @@ public Product Product set { Product previousValue = this._Product.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Product.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2541,7 +2541,7 @@ public Customer Customer set { Customer previousValue = this._Customer.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Customer.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2575,7 +2575,7 @@ public Employee Employee set { Employee previousValue = this._Employee.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Employee.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2609,7 +2609,7 @@ public Shipper Shipper set { Shipper previousValue = this._Shipper.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Shipper.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2965,7 +2965,7 @@ public Category Category set { Category previousValue = this._Category.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Category.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2999,7 +2999,7 @@ public Supplier Supplier set { Supplier previousValue = this._Supplier.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Supplier.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -3792,7 +3792,7 @@ public Region Region set { Region previousValue = this._Region.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Region.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); diff --git a/samples/snippets/csharp/VS_Snippets_Data/DLinqOverrideDefaultSproc/cs/northwind.cs b/samples/snippets/csharp/VS_Snippets_Data/DLinqOverrideDefaultSproc/cs/northwind.cs index c3ff7ba89036a..79e3ab2a5ee39 100644 --- a/samples/snippets/csharp/VS_Snippets_Data/DLinqOverrideDefaultSproc/cs/northwind.cs +++ b/samples/snippets/csharp/VS_Snippets_Data/DLinqOverrideDefaultSproc/cs/northwind.cs @@ -73,25 +73,25 @@ static Northwnd() { } - public Northwnd(string connection) : + public Northwnd(string connection) : base(connection, mappingSource) { OnCreated(); } - public Northwnd(System.Data.IDbConnection connection) : + public Northwnd(System.Data.IDbConnection connection) : base(connection, mappingSource) { OnCreated(); } - public Northwnd(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) : + public Northwnd(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) : base(connection, mappingSource) { OnCreated(); } - public Northwnd(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : + public Northwnd(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : base(connection, mappingSource) { OnCreated(); @@ -204,7 +204,7 @@ public System.Data.Linq.Table Territories // [Function()] public IEnumerable CustomersByCity( - [Parameter(Name = "City", DbType = "NVarChar(15)")] + [Parameter(Name = "City", DbType = "NVarChar(15)")] string city) { IExecuteResult result = this.ExecuteMethodCall(this, @@ -241,7 +241,7 @@ public IEnumerable CustomerById( - + [Function(Name="dbo.CustOrderHist")] public ISingleResult CustOrderHist([Parameter(Name="CustomerID", DbType="NChar(5)")] string customerID) { @@ -545,7 +545,7 @@ public CustomerDemographic CustomerDemographic set { CustomerDemographic previousValue = this._CustomerDemographic.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._CustomerDemographic.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -579,7 +579,7 @@ public Customer Customer set { Customer previousValue = this._Customer.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Customer.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1577,7 +1577,7 @@ public Employee ReportsToEmployee set { Employee previousValue = this._ReportsToEmployee.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._ReportsToEmployee.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1792,7 +1792,7 @@ public Employee Employee set { Employee previousValue = this._Employee.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Employee.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1826,7 +1826,7 @@ public Territory Territory set { Territory previousValue = this._Territory.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Territory.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2032,7 +2032,7 @@ public Order Order set { Order previousValue = this._Order.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Order.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2066,7 +2066,7 @@ public Product Product set { Product previousValue = this._Product.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Product.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2511,7 +2511,7 @@ public Customer Customer set { Customer previousValue = this._Customer.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Customer.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2545,7 +2545,7 @@ public Employee Employee set { Employee previousValue = this._Employee.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Employee.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2579,7 +2579,7 @@ public Shipper Shipper set { Shipper previousValue = this._Shipper.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Shipper.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2935,7 +2935,7 @@ public Category Category set { Category previousValue = this._Category.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Category.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2969,7 +2969,7 @@ public Supplier Supplier set { Supplier previousValue = this._Supplier.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Supplier.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -3762,7 +3762,7 @@ public Region Region set { Region previousValue = this._Region.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Region.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); diff --git a/samples/snippets/csharp/VS_Snippets_Data/DLinqQueryConcepts/cs/Program.cs b/samples/snippets/csharp/VS_Snippets_Data/DLinqQueryConcepts/cs/Program.cs index 4ce8dd6425e07..729ec809cfb9e 100644 --- a/samples/snippets/csharp/VS_Snippets_Data/DLinqQueryConcepts/cs/Program.cs +++ b/samples/snippets/csharp/VS_Snippets_Data/DLinqQueryConcepts/cs/Program.cs @@ -115,7 +115,7 @@ void method7() // Northwnd db = new Northwnd(@"northwnd.mdf"); Customer c = db.Customers.Single(x => x.CustomerID == "19283"); -foreach (Order ord in +foreach (Order ord in c.Orders.Where(o => o.ShippedDate.Value.Year == 1998)) { // Do something. @@ -130,7 +130,7 @@ void method8() Customer c = db.Customers.Single(x => x.CustomerID == "19283"); c.Orders.Load(); -foreach (Order ord in +foreach (Order ord in c.Orders.Where(o => o.ShippedDate.Value.Year == 1998)) { // Do something. diff --git a/samples/snippets/csharp/VS_Snippets_Data/DLinqQueryConcepts/cs/northwind.cs b/samples/snippets/csharp/VS_Snippets_Data/DLinqQueryConcepts/cs/northwind.cs index 1c53905bc06bd..8264c50f5f4fc 100644 --- a/samples/snippets/csharp/VS_Snippets_Data/DLinqQueryConcepts/cs/northwind.cs +++ b/samples/snippets/csharp/VS_Snippets_Data/DLinqQueryConcepts/cs/northwind.cs @@ -73,25 +73,25 @@ static Northwnd() { } - public Northwnd(string connection) : + public Northwnd(string connection) : base(connection, mappingSource) { OnCreated(); } - public Northwnd(System.Data.IDbConnection connection) : + public Northwnd(System.Data.IDbConnection connection) : base(connection, mappingSource) { OnCreated(); } - public Northwnd(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) : + public Northwnd(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) : base(connection, mappingSource) { OnCreated(); } - public Northwnd(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : + public Northwnd(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : base(connection, mappingSource) { OnCreated(); @@ -504,7 +504,7 @@ public CustomerDemographic CustomerDemographic set { CustomerDemographic previousValue = this._CustomerDemographic.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._CustomerDemographic.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -538,7 +538,7 @@ public Customer Customer set { Customer previousValue = this._Customer.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Customer.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1536,7 +1536,7 @@ public Employee ReportsToEmployee set { Employee previousValue = this._ReportsToEmployee.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._ReportsToEmployee.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1751,7 +1751,7 @@ public Employee Employee set { Employee previousValue = this._Employee.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Employee.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1785,7 +1785,7 @@ public Territory Territory set { Territory previousValue = this._Territory.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Territory.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1991,7 +1991,7 @@ public Order Order set { Order previousValue = this._Order.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Order.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2025,7 +2025,7 @@ public Product Product set { Product previousValue = this._Product.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Product.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2470,7 +2470,7 @@ public Customer Customer set { Customer previousValue = this._Customer.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Customer.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2504,7 +2504,7 @@ public Employee Employee set { Employee previousValue = this._Employee.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Employee.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2538,7 +2538,7 @@ public Shipper Shipper set { Shipper previousValue = this._Shipper.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Shipper.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2894,7 +2894,7 @@ public Category Category set { Category previousValue = this._Category.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Category.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2928,7 +2928,7 @@ public Supplier Supplier set { Supplier previousValue = this._Supplier.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Supplier.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -3721,7 +3721,7 @@ public Region Region set { Region previousValue = this._Region.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Region.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); diff --git a/samples/snippets/csharp/VS_Snippets_Data/DLinqQueryExamples/cs/northwind.cs b/samples/snippets/csharp/VS_Snippets_Data/DLinqQueryExamples/cs/northwind.cs index 3b9ddc00941a2..13bd829fd38cc 100644 --- a/samples/snippets/csharp/VS_Snippets_Data/DLinqQueryExamples/cs/northwind.cs +++ b/samples/snippets/csharp/VS_Snippets_Data/DLinqQueryExamples/cs/northwind.cs @@ -73,25 +73,25 @@ static Northwnd() { } - public Northwnd(string connection) : + public Northwnd(string connection) : base(connection, mappingSource) { OnCreated(); } - public Northwnd(System.Data.IDbConnection connection) : + public Northwnd(System.Data.IDbConnection connection) : base(connection, mappingSource) { OnCreated(); } - public Northwnd(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) : + public Northwnd(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) : base(connection, mappingSource) { OnCreated(); } - public Northwnd(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : + public Northwnd(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : base(connection, mappingSource) { OnCreated(); @@ -504,7 +504,7 @@ public CustomerDemographic CustomerDemographic set { CustomerDemographic previousValue = this._CustomerDemographic.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._CustomerDemographic.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -538,7 +538,7 @@ public Customer Customer set { Customer previousValue = this._Customer.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Customer.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1536,7 +1536,7 @@ public Employee ReportsToEmployee set { Employee previousValue = this._ReportsToEmployee.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._ReportsToEmployee.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1751,7 +1751,7 @@ public Employee Employee set { Employee previousValue = this._Employee.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Employee.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1785,7 +1785,7 @@ public Territory Territory set { Territory previousValue = this._Territory.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Territory.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1991,7 +1991,7 @@ public Order Order set { Order previousValue = this._Order.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Order.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2025,7 +2025,7 @@ public Product Product set { Product previousValue = this._Product.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Product.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2470,7 +2470,7 @@ public Customer Customer set { Customer previousValue = this._Customer.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Customer.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2504,7 +2504,7 @@ public Employee Employee set { Employee previousValue = this._Employee.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Employee.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2538,7 +2538,7 @@ public Shipper Shipper set { Shipper previousValue = this._Shipper.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Shipper.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2894,7 +2894,7 @@ public Category Category set { Category previousValue = this._Category.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Category.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2928,7 +2928,7 @@ public Supplier Supplier set { Supplier previousValue = this._Supplier.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Supplier.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -3721,7 +3721,7 @@ public Region Region set { Region previousValue = this._Region.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Region.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); diff --git a/samples/snippets/csharp/VS_Snippets_Data/DLinqQuerying/cs/northwind.cs b/samples/snippets/csharp/VS_Snippets_Data/DLinqQuerying/cs/northwind.cs index 740a5d2cbbf59..ac4a6ea8edba3 100644 --- a/samples/snippets/csharp/VS_Snippets_Data/DLinqQuerying/cs/northwind.cs +++ b/samples/snippets/csharp/VS_Snippets_Data/DLinqQuerying/cs/northwind.cs @@ -73,25 +73,25 @@ static Northwnd() { } - public Northwnd(string connection) : + public Northwnd(string connection) : base(connection, mappingSource) { OnCreated(); } - public Northwnd(System.Data.IDbConnection connection) : + public Northwnd(System.Data.IDbConnection connection) : base(connection, mappingSource) { OnCreated(); } - public Northwnd(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) : + public Northwnd(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) : base(connection, mappingSource) { OnCreated(); } - public Northwnd(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : + public Northwnd(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : base(connection, mappingSource) { OnCreated(); @@ -504,7 +504,7 @@ public CustomerDemographic CustomerDemographic set { CustomerDemographic previousValue = this._CustomerDemographic.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._CustomerDemographic.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -538,7 +538,7 @@ public Customer Customer set { Customer previousValue = this._Customer.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Customer.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1536,7 +1536,7 @@ public Employee ReportsToEmployee set { Employee previousValue = this._ReportsToEmployee.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._ReportsToEmployee.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1751,7 +1751,7 @@ public Employee Employee set { Employee previousValue = this._Employee.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Employee.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1785,7 +1785,7 @@ public Territory Territory set { Territory previousValue = this._Territory.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Territory.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1991,7 +1991,7 @@ public Order Order set { Order previousValue = this._Order.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Order.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2025,7 +2025,7 @@ public Product Product set { Product previousValue = this._Product.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Product.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2470,7 +2470,7 @@ public Customer Customer set { Customer previousValue = this._Customer.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Customer.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2504,7 +2504,7 @@ public Employee Employee set { Employee previousValue = this._Employee.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Employee.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2538,7 +2538,7 @@ public Shipper Shipper set { Shipper previousValue = this._Shipper.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Shipper.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2894,7 +2894,7 @@ public Category Category set { Category previousValue = this._Category.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Category.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2928,7 +2928,7 @@ public Supplier Supplier set { Supplier previousValue = this._Supplier.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Supplier.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -3721,7 +3721,7 @@ public Region Region set { Region previousValue = this._Region.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Region.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); diff --git a/samples/snippets/csharp/VS_Snippets_Data/DLinqSQOTranslation/cs/Program.cs b/samples/snippets/csharp/VS_Snippets_Data/DLinqSQOTranslation/cs/Program.cs index a3cbb57169186..1ec27d28412a9 100644 --- a/samples/snippets/csharp/VS_Snippets_Data/DLinqSQOTranslation/cs/Program.cs +++ b/samples/snippets/csharp/VS_Snippets_Data/DLinqSQOTranslation/cs/Program.cs @@ -12,7 +12,7 @@ static void Main(string[] args) Northwnd db = new Northwnd(@"c:\northwnd.mdf"); // - var custQuery = + var custQuery = (from cust in db.Customers where cust.City == "London" orderby cust.CustomerID diff --git a/samples/snippets/csharp/VS_Snippets_Data/DLinqSQOTranslation/cs/northwind.cs b/samples/snippets/csharp/VS_Snippets_Data/DLinqSQOTranslation/cs/northwind.cs index 740a5d2cbbf59..ac4a6ea8edba3 100644 --- a/samples/snippets/csharp/VS_Snippets_Data/DLinqSQOTranslation/cs/northwind.cs +++ b/samples/snippets/csharp/VS_Snippets_Data/DLinqSQOTranslation/cs/northwind.cs @@ -73,25 +73,25 @@ static Northwnd() { } - public Northwnd(string connection) : + public Northwnd(string connection) : base(connection, mappingSource) { OnCreated(); } - public Northwnd(System.Data.IDbConnection connection) : + public Northwnd(System.Data.IDbConnection connection) : base(connection, mappingSource) { OnCreated(); } - public Northwnd(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) : + public Northwnd(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) : base(connection, mappingSource) { OnCreated(); } - public Northwnd(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : + public Northwnd(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : base(connection, mappingSource) { OnCreated(); @@ -504,7 +504,7 @@ public CustomerDemographic CustomerDemographic set { CustomerDemographic previousValue = this._CustomerDemographic.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._CustomerDemographic.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -538,7 +538,7 @@ public Customer Customer set { Customer previousValue = this._Customer.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Customer.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1536,7 +1536,7 @@ public Employee ReportsToEmployee set { Employee previousValue = this._ReportsToEmployee.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._ReportsToEmployee.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1751,7 +1751,7 @@ public Employee Employee set { Employee previousValue = this._Employee.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Employee.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1785,7 +1785,7 @@ public Territory Territory set { Territory previousValue = this._Territory.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Territory.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1991,7 +1991,7 @@ public Order Order set { Order previousValue = this._Order.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Order.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2025,7 +2025,7 @@ public Product Product set { Product previousValue = this._Product.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Product.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2470,7 +2470,7 @@ public Customer Customer set { Customer previousValue = this._Customer.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Customer.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2504,7 +2504,7 @@ public Employee Employee set { Employee previousValue = this._Employee.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Employee.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2538,7 +2538,7 @@ public Shipper Shipper set { Shipper previousValue = this._Shipper.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Shipper.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2894,7 +2894,7 @@ public Category Category set { Category previousValue = this._Category.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Category.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2928,7 +2928,7 @@ public Supplier Supplier set { Supplier previousValue = this._Supplier.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Supplier.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -3721,7 +3721,7 @@ public Region Region set { Region previousValue = this._Region.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Region.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); diff --git a/samples/snippets/csharp/VS_Snippets_Data/DLinqSerialization/cs/Program.cs b/samples/snippets/csharp/VS_Snippets_Data/DLinqSerialization/cs/Program.cs index 4be0d10cb7713..a4a46b9f5fc22 100644 --- a/samples/snippets/csharp/VS_Snippets_Data/DLinqSerialization/cs/Program.cs +++ b/samples/snippets/csharp/VS_Snippets_Data/DLinqSerialization/cs/Program.cs @@ -19,7 +19,7 @@ static void Main(string[] args) Customer cust = db.Customers.Where(c => c.CustomerID == "ALFKI").Single(); -DataContractSerializer dcs = +DataContractSerializer dcs = new DataContractSerializer(typeof(Customer)); StringBuilder sb = new StringBuilder(); XmlWriter writer = XmlWriter.Create(sb); diff --git a/samples/snippets/csharp/VS_Snippets_Data/DLinqSerialization/cs/northwind-ser.cs b/samples/snippets/csharp/VS_Snippets_Data/DLinqSerialization/cs/northwind-ser.cs index 4b3075bf9b068..446637ad6113e 100644 --- a/samples/snippets/csharp/VS_Snippets_Data/DLinqSerialization/cs/northwind-ser.cs +++ b/samples/snippets/csharp/VS_Snippets_Data/DLinqSerialization/cs/northwind-ser.cs @@ -74,25 +74,25 @@ static Northwnd() { } - public Northwnd(string connection) : + public Northwnd(string connection) : base(connection, mappingSource) { OnCreated(); } - public Northwnd(System.Data.IDbConnection connection) : + public Northwnd(System.Data.IDbConnection connection) : base(connection, mappingSource) { OnCreated(); } - public Northwnd(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) : + public Northwnd(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) : base(connection, mappingSource) { OnCreated(); } - public Northwnd(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : + public Northwnd(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : base(connection, mappingSource) { OnCreated(); @@ -523,7 +523,7 @@ public CustomerDemographic CustomerDemographic set { CustomerDemographic previousValue = this._CustomerDemographic.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._CustomerDemographic.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -557,7 +557,7 @@ public Customer Customer set { Customer previousValue = this._Customer.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Customer.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -807,7 +807,7 @@ public partial class Customer : INotifyPropertyChanging, INotifyPropertyChanged partial void OnFaxChanging(string value); partial void OnFaxChanged(); #endregion - + // // Private fields are not decorated with any attributes, and are // elided. @@ -1651,7 +1651,7 @@ public Employee ReportsToEmployee set { Employee previousValue = this._ReportsToEmployee.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._ReportsToEmployee.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1885,7 +1885,7 @@ public Employee Employee set { Employee previousValue = this._Employee.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Employee.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1919,7 +1919,7 @@ public Territory Territory set { Territory previousValue = this._Territory.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Territory.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2142,7 +2142,7 @@ public Order Order set { Order previousValue = this._Order.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Order.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2176,7 +2176,7 @@ public Product Product set { Product previousValue = this._Product.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Product.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2684,7 +2684,7 @@ public EntitySet OrderDetails // *** //[Association(Name="FK_Orders_Customers", Storage="_Customer", ThisKey="CustomerID", IsForeignKey=true)] //public Customer Customer - + //{ // get // { @@ -2693,7 +2693,7 @@ public EntitySet OrderDetails // set // { // Customer previousValue = this._Customer.Entity; - // if (((previousValue != value) + // if (((previousValue != value) // || (this._Customer.HasLoadedOrAssignedValue == false))) // { // this.SendPropertyChanging(); @@ -2727,7 +2727,7 @@ public Employee Employee set { Employee previousValue = this._Employee.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Employee.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2761,7 +2761,7 @@ public Shipper Shipper set { Shipper previousValue = this._Shipper.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Shipper.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -3141,7 +3141,7 @@ public Category Category set { Category previousValue = this._Category.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Category.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -3175,7 +3175,7 @@ public Supplier Supplier set { Supplier previousValue = this._Supplier.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Supplier.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -4041,7 +4041,7 @@ public Region Region set { Region previousValue = this._Region.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Region.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); diff --git a/samples/snippets/csharp/VS_Snippets_Data/DLinqSprox/cs/Program.cs b/samples/snippets/csharp/VS_Snippets_Data/DLinqSprox/cs/Program.cs index f46825ea834f6..5d183abe4ce7d 100644 --- a/samples/snippets/csharp/VS_Snippets_Data/DLinqSprox/cs/Program.cs +++ b/samples/snippets/csharp/VS_Snippets_Data/DLinqSprox/cs/Program.cs @@ -39,7 +39,7 @@ void CallMultiple() // Pause to view company names; press Enter to continue. Console.ReadLine(); - + // Assign the results of the procedure with an argument // of (2) to local variable 'result'. IMultipleResults result2 = db.VariableResultShapes(2); diff --git a/samples/snippets/csharp/VS_Snippets_Data/DLinqSprox/cs/northwind-sprox.cs b/samples/snippets/csharp/VS_Snippets_Data/DLinqSprox/cs/northwind-sprox.cs index 895a506b86807..2342f48813765 100644 --- a/samples/snippets/csharp/VS_Snippets_Data/DLinqSprox/cs/northwind-sprox.cs +++ b/samples/snippets/csharp/VS_Snippets_Data/DLinqSprox/cs/northwind-sprox.cs @@ -73,25 +73,25 @@ static Northwnd() { } - public Northwnd(string connection) : + public Northwnd(string connection) : base(connection, mappingSource) { OnCreated(); } - public Northwnd(System.Data.IDbConnection connection) : + public Northwnd(System.Data.IDbConnection connection) : base(connection, mappingSource) { OnCreated(); } - public Northwnd(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) : + public Northwnd(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) : base(connection, mappingSource) { OnCreated(); } - public Northwnd(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : + public Northwnd(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : base(connection, mappingSource) { OnCreated(); @@ -561,7 +561,7 @@ public CustomerDemographic CustomerDemographic set { CustomerDemographic previousValue = this._CustomerDemographic.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._CustomerDemographic.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -595,7 +595,7 @@ public Customer Customer set { Customer previousValue = this._Customer.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Customer.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1593,7 +1593,7 @@ public Employee ReportsToEmployee set { Employee previousValue = this._ReportsToEmployee.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._ReportsToEmployee.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1808,7 +1808,7 @@ public Employee Employee set { Employee previousValue = this._Employee.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Employee.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1842,7 +1842,7 @@ public Territory Territory set { Territory previousValue = this._Territory.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Territory.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2048,7 +2048,7 @@ public Order Order set { Order previousValue = this._Order.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Order.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2082,7 +2082,7 @@ public Product Product set { Product previousValue = this._Product.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Product.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2527,7 +2527,7 @@ public Customer Customer set { Customer previousValue = this._Customer.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Customer.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2561,7 +2561,7 @@ public Employee Employee set { Employee previousValue = this._Employee.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Employee.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2595,7 +2595,7 @@ public Shipper Shipper set { Shipper previousValue = this._Shipper.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Shipper.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2951,7 +2951,7 @@ public Category Category set { Category previousValue = this._Category.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Category.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2985,7 +2985,7 @@ public Supplier Supplier set { Supplier previousValue = this._Supplier.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Supplier.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -3778,7 +3778,7 @@ public Region Region set { Region previousValue = this._Region.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Region.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); diff --git a/samples/snippets/csharp/VS_Snippets_Data/DLinqSubmittingChanges/cs/Program.cs b/samples/snippets/csharp/VS_Snippets_Data/DLinqSubmittingChanges/cs/Program.cs index 95d46e439a2ff..b32c7687b9ea9 100644 --- a/samples/snippets/csharp/VS_Snippets_Data/DLinqSubmittingChanges/cs/Program.cs +++ b/samples/snippets/csharp/VS_Snippets_Data/DLinqSubmittingChanges/cs/Program.cs @@ -15,7 +15,7 @@ static void Main(string[] args) { // Northwnd db = new Northwnd(@"c:\northwnd.mdf"); - // Make changes here. + // Make changes here. try { db.SubmitChanges(); diff --git a/samples/snippets/csharp/VS_Snippets_Data/DLinqSubmittingChanges/cs/northwind.cs b/samples/snippets/csharp/VS_Snippets_Data/DLinqSubmittingChanges/cs/northwind.cs index 740a5d2cbbf59..ac4a6ea8edba3 100644 --- a/samples/snippets/csharp/VS_Snippets_Data/DLinqSubmittingChanges/cs/northwind.cs +++ b/samples/snippets/csharp/VS_Snippets_Data/DLinqSubmittingChanges/cs/northwind.cs @@ -73,25 +73,25 @@ static Northwnd() { } - public Northwnd(string connection) : + public Northwnd(string connection) : base(connection, mappingSource) { OnCreated(); } - public Northwnd(System.Data.IDbConnection connection) : + public Northwnd(System.Data.IDbConnection connection) : base(connection, mappingSource) { OnCreated(); } - public Northwnd(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) : + public Northwnd(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) : base(connection, mappingSource) { OnCreated(); } - public Northwnd(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : + public Northwnd(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : base(connection, mappingSource) { OnCreated(); @@ -504,7 +504,7 @@ public CustomerDemographic CustomerDemographic set { CustomerDemographic previousValue = this._CustomerDemographic.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._CustomerDemographic.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -538,7 +538,7 @@ public Customer Customer set { Customer previousValue = this._Customer.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Customer.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1536,7 +1536,7 @@ public Employee ReportsToEmployee set { Employee previousValue = this._ReportsToEmployee.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._ReportsToEmployee.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1751,7 +1751,7 @@ public Employee Employee set { Employee previousValue = this._Employee.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Employee.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1785,7 +1785,7 @@ public Territory Territory set { Territory previousValue = this._Territory.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Territory.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1991,7 +1991,7 @@ public Order Order set { Order previousValue = this._Order.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Order.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2025,7 +2025,7 @@ public Product Product set { Product previousValue = this._Product.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Product.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2470,7 +2470,7 @@ public Customer Customer set { Customer previousValue = this._Customer.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Customer.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2504,7 +2504,7 @@ public Employee Employee set { Employee previousValue = this._Employee.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Employee.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2538,7 +2538,7 @@ public Shipper Shipper set { Shipper previousValue = this._Shipper.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Shipper.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2894,7 +2894,7 @@ public Category Category set { Category previousValue = this._Category.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Category.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2928,7 +2928,7 @@ public Supplier Supplier set { Supplier previousValue = this._Supplier.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Supplier.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -3721,7 +3721,7 @@ public Region Region set { Region previousValue = this._Region.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Region.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); diff --git a/samples/snippets/csharp/VS_Snippets_Data/DLinqUDFS/cs/Program.cs b/samples/snippets/csharp/VS_Snippets_Data/DLinqUDFS/cs/Program.cs index 7f1ef4b33a39e..648afd29c64fd 100644 --- a/samples/snippets/csharp/VS_Snippets_Data/DLinqUDFS/cs/Program.cs +++ b/samples/snippets/csharp/VS_Snippets_Data/DLinqUDFS/cs/Program.cs @@ -33,7 +33,7 @@ void method5() // var custQuery = from cust in db.Customers - select new {cust.ContactName, Title = + select new {cust.ContactName, Title = db.ReverseCustName(cust.ContactTitle)}; // } diff --git a/samples/snippets/csharp/VS_Snippets_Data/DLinqUDFS/cs/northwind-tfunc.cs b/samples/snippets/csharp/VS_Snippets_Data/DLinqUDFS/cs/northwind-tfunc.cs index 4bc78d48dcb4d..0ce4b91b1b8d3 100644 --- a/samples/snippets/csharp/VS_Snippets_Data/DLinqUDFS/cs/northwind-tfunc.cs +++ b/samples/snippets/csharp/VS_Snippets_Data/DLinqUDFS/cs/northwind-tfunc.cs @@ -73,25 +73,25 @@ static Northwnd() { } - public Northwnd(string connection) : + public Northwnd(string connection) : base(connection, mappingSource) { OnCreated(); } - public Northwnd(System.Data.IDbConnection connection) : + public Northwnd(System.Data.IDbConnection connection) : base(connection, mappingSource) { OnCreated(); } - public Northwnd(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) : + public Northwnd(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) : base(connection, mappingSource) { OnCreated(); } - public Northwnd(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : + public Northwnd(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : base(connection, mappingSource) { OnCreated(); @@ -527,7 +527,7 @@ public CustomerDemographic CustomerDemographic set { CustomerDemographic previousValue = this._CustomerDemographic.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._CustomerDemographic.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -561,7 +561,7 @@ public Customer Customer set { Customer previousValue = this._Customer.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Customer.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1559,7 +1559,7 @@ public Employee ReportsToEmployee set { Employee previousValue = this._ReportsToEmployee.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._ReportsToEmployee.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1774,7 +1774,7 @@ public Employee Employee set { Employee previousValue = this._Employee.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Employee.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1808,7 +1808,7 @@ public Territory Territory set { Territory previousValue = this._Territory.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Territory.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2014,7 +2014,7 @@ public Order Order set { Order previousValue = this._Order.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Order.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2048,7 +2048,7 @@ public Product Product set { Product previousValue = this._Product.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Product.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2493,7 +2493,7 @@ public Customer Customer set { Customer previousValue = this._Customer.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Customer.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2527,7 +2527,7 @@ public Employee Employee set { Employee previousValue = this._Employee.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Employee.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2561,7 +2561,7 @@ public Shipper Shipper set { Shipper previousValue = this._Shipper.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Shipper.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2917,7 +2917,7 @@ public Category Category set { Category previousValue = this._Category.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Category.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2951,7 +2951,7 @@ public Supplier Supplier set { Supplier previousValue = this._Supplier.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Supplier.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -3744,7 +3744,7 @@ public Region Region set { Region previousValue = this._Region.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Region.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); diff --git a/samples/snippets/csharp/VS_Snippets_Data/DLinqWalk1CS/cs/Program.cs b/samples/snippets/csharp/VS_Snippets_Data/DLinqWalk1CS/cs/Program.cs index 3c9868cd976e5..0b267c7ab987c 100644 --- a/samples/snippets/csharp/VS_Snippets_Data/DLinqWalk1CS/cs/Program.cs +++ b/samples/snippets/csharp/VS_Snippets_Data/DLinqWalk1CS/cs/Program.cs @@ -32,7 +32,7 @@ public class Customer public class snippet3 { - + // private string _CustomerID; [Column(IsPrimaryKey=true, Storage="_CustomerID")] diff --git a/samples/snippets/csharp/VS_Snippets_Data/DLinqWalk2CS/cs/Program.cs b/samples/snippets/csharp/VS_Snippets_Data/DLinqWalk2CS/cs/Program.cs index 9b60f6ed113fc..b5a58c122bbdb 100644 --- a/samples/snippets/csharp/VS_Snippets_Data/DLinqWalk2CS/cs/Program.cs +++ b/samples/snippets/csharp/VS_Snippets_Data/DLinqWalk2CS/cs/Program.cs @@ -21,7 +21,7 @@ static void Main(string[] args) // // Query for customers who have placed orders. - var custQuery = + var custQuery = from cust in Customers where cust.Orders.Any() select cust; @@ -40,7 +40,7 @@ void method5() // Use a connection string. Northwind db = new Northwind(@"C:\linqtest5\northwnd.mdf"); - // Query for customers from Seattle. + // Query for customers from Seattle. var custQuery = from cust in db.Customers where cust.City == "Seattle" diff --git a/samples/snippets/csharp/VS_Snippets_Data/DLinqWalk3CS/cs/northwind.cs b/samples/snippets/csharp/VS_Snippets_Data/DLinqWalk3CS/cs/northwind.cs index 3f692f7ea35bc..1a7cfe67b61bf 100644 --- a/samples/snippets/csharp/VS_Snippets_Data/DLinqWalk3CS/cs/northwind.cs +++ b/samples/snippets/csharp/VS_Snippets_Data/DLinqWalk3CS/cs/northwind.cs @@ -73,25 +73,25 @@ static Northwnd() { } - public Northwnd(string connection) : + public Northwnd(string connection) : base(connection, mappingSource) { OnCreated(); } - public Northwnd(System.Data.IDbConnection connection) : + public Northwnd(System.Data.IDbConnection connection) : base(connection, mappingSource) { OnCreated(); } - public Northwnd(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) : + public Northwnd(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) : base(connection, mappingSource) { OnCreated(); } - public Northwnd(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : + public Northwnd(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : base(connection, mappingSource) { OnCreated(); @@ -504,7 +504,7 @@ public CustomerDemographic CustomerDemographic set { CustomerDemographic previousValue = this._CustomerDemographic.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._CustomerDemographic.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -538,7 +538,7 @@ public Customer Customer set { Customer previousValue = this._Customer.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Customer.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1536,7 +1536,7 @@ public Employee ReportsToEmployee set { Employee previousValue = this._ReportsToEmployee.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._ReportsToEmployee.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1751,7 +1751,7 @@ public Employee Employee set { Employee previousValue = this._Employee.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Employee.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1785,7 +1785,7 @@ public Territory Territory set { Territory previousValue = this._Territory.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Territory.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1991,7 +1991,7 @@ public Order Order set { Order previousValue = this._Order.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Order.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2025,7 +2025,7 @@ public Product Product set { Product previousValue = this._Product.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Product.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2470,7 +2470,7 @@ public Customer Customer set { Customer previousValue = this._Customer.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Customer.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2504,7 +2504,7 @@ public Employee Employee set { Employee previousValue = this._Employee.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Employee.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2538,7 +2538,7 @@ public Shipper Shipper set { Shipper previousValue = this._Shipper.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Shipper.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2894,7 +2894,7 @@ public Category Category set { Category previousValue = this._Category.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Category.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2928,7 +2928,7 @@ public Supplier Supplier set { Supplier previousValue = this._Supplier.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Supplier.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -3721,7 +3721,7 @@ public Region Region set { Region previousValue = this._Region.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Region.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); diff --git a/samples/snippets/csharp/VS_Snippets_Data/DLinqWalk4CS/cs/Form1.Designer.cs b/samples/snippets/csharp/VS_Snippets_Data/DLinqWalk4CS/cs/Form1.Designer.cs index f9aaa47bdf43f..cb18a8fb21bbe 100644 --- a/samples/snippets/csharp/VS_Snippets_Data/DLinqWalk4CS/cs/Form1.Designer.cs +++ b/samples/snippets/csharp/VS_Snippets_Data/DLinqWalk4CS/cs/Form1.Designer.cs @@ -35,9 +35,9 @@ private void InitializeComponent() this.label1 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.SuspendLayout(); - // + // // button1 - // + // this.button1.Location = new System.Drawing.Point(38, 27); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(197, 23); @@ -45,9 +45,9 @@ private void InitializeComponent() this.button1.Text = "Order Details"; this.button1.UseVisualStyleBackColor = true; this.button1.Click += new System.EventHandler(this.button1_Click); - // + // // button2 - // + // this.button2.Location = new System.Drawing.Point(58, 75); this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(186, 23); @@ -55,41 +55,41 @@ private void InitializeComponent() this.button2.Text = "Order History"; this.button2.UseVisualStyleBackColor = true; this.button2.Click += new System.EventHandler(this.button2_Click); - // + // // textBox1 - // + // this.textBox1.Location = new System.Drawing.Point(58, 133); this.textBox1.Name = "textBox1"; this.textBox1.Size = new System.Drawing.Size(100, 20); this.textBox1.TabIndex = 2; - // + // // textBox2 - // + // this.textBox2.Location = new System.Drawing.Point(80, 190); this.textBox2.Name = "textBox2"; this.textBox2.Size = new System.Drawing.Size(100, 20); this.textBox2.TabIndex = 3; - // + // // label1 - // + // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(259, 36); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(75, 13); this.label1.TabIndex = 4; this.label1.Text = "Enter OrderID:"; - // + // // label2 - // + // this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(311, 103); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(99, 13); this.label2.TabIndex = 5; this.label2.Text = "Enter CustgomerID:"; - // + // // Form1 - // + // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(445, 266); diff --git a/samples/snippets/csharp/VS_Snippets_Data/DLinqWalk4CS/cs/northwind.cs b/samples/snippets/csharp/VS_Snippets_Data/DLinqWalk4CS/cs/northwind.cs index 3f692f7ea35bc..1a7cfe67b61bf 100644 --- a/samples/snippets/csharp/VS_Snippets_Data/DLinqWalk4CS/cs/northwind.cs +++ b/samples/snippets/csharp/VS_Snippets_Data/DLinqWalk4CS/cs/northwind.cs @@ -73,25 +73,25 @@ static Northwnd() { } - public Northwnd(string connection) : + public Northwnd(string connection) : base(connection, mappingSource) { OnCreated(); } - public Northwnd(System.Data.IDbConnection connection) : + public Northwnd(System.Data.IDbConnection connection) : base(connection, mappingSource) { OnCreated(); } - public Northwnd(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) : + public Northwnd(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) : base(connection, mappingSource) { OnCreated(); } - public Northwnd(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : + public Northwnd(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : base(connection, mappingSource) { OnCreated(); @@ -504,7 +504,7 @@ public CustomerDemographic CustomerDemographic set { CustomerDemographic previousValue = this._CustomerDemographic.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._CustomerDemographic.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -538,7 +538,7 @@ public Customer Customer set { Customer previousValue = this._Customer.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Customer.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1536,7 +1536,7 @@ public Employee ReportsToEmployee set { Employee previousValue = this._ReportsToEmployee.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._ReportsToEmployee.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1751,7 +1751,7 @@ public Employee Employee set { Employee previousValue = this._Employee.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Employee.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1785,7 +1785,7 @@ public Territory Territory set { Territory previousValue = this._Territory.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Territory.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1991,7 +1991,7 @@ public Order Order set { Order previousValue = this._Order.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Order.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2025,7 +2025,7 @@ public Product Product set { Product previousValue = this._Product.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Product.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2470,7 +2470,7 @@ public Customer Customer set { Customer previousValue = this._Customer.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Customer.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2504,7 +2504,7 @@ public Employee Employee set { Employee previousValue = this._Employee.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Employee.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2538,7 +2538,7 @@ public Shipper Shipper set { Shipper previousValue = this._Shipper.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Shipper.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2894,7 +2894,7 @@ public Category Category set { Category previousValue = this._Category.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Category.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -2928,7 +2928,7 @@ public Supplier Supplier set { Supplier previousValue = this._Supplier.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Supplier.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -3721,7 +3721,7 @@ public Region Region set { Region previousValue = this._Region.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Region.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); diff --git a/samples/snippets/csharp/VS_Snippets_Data/DP L2E Conceptual Examples/CS/Program.cs b/samples/snippets/csharp/VS_Snippets_Data/DP L2E Conceptual Examples/CS/Program.cs index a2f0ea27eae3f..48e99179e8ec3 100644 --- a/samples/snippets/csharp/VS_Snippets_Data/DP L2E Conceptual Examples/CS/Program.cs +++ b/samples/snippets/csharp/VS_Snippets_Data/DP L2E Conceptual Examples/CS/Program.cs @@ -45,7 +45,7 @@ static void Main(string[] args) // AnonymousTypeInitialization_MQ(); // TypeInitialization(); // TypeInitialization_MQ(); - + //WhereExpression(); //LiteralParameter1(); //int orderID = 51987; @@ -56,7 +56,7 @@ static void Main(string[] args) //CanonicalFuncVsCLRBaseType(); //ConvertExpression(); //NonSymmetricGetterSetter(); - + //*** Nav property examples ***// //NavPropLoadError(); // NavProperty_MQ(); @@ -109,7 +109,7 @@ from s in context.SalesOrderHeaders Console.WriteLine(orderNum); } } - // + // } static void RestrictionExpression() @@ -205,7 +205,7 @@ class AClass { public int ID;} // static void PropertyAsConstant() { - // + // using (AdventureWorksEntities context = new AdventureWorksEntities()) { AClass aClass = new AClass(); @@ -236,7 +236,7 @@ class MyClass2 static void MethodAsConstantFails() { - // + // using (AdventureWorksEntities context = new AdventureWorksEntities()) { MyClass2 myClass = new MyClass2(); @@ -267,14 +267,14 @@ from s in context.SalesOrderHeaders static void NullComparison() { - // + // using (AdventureWorksEntities context = new AdventureWorksEntities()) { ObjectQuery sales = context.SalesOrderHeaders; //Throws a NotSupportedException /* var orders = from c in edm.Cusomters - join c2 in edm.Orders + join c2 in edm.Orders on c.Region == c2.ShipRegion where c.Region == null select c.CustomerID; @@ -308,7 +308,7 @@ static void CastResultsIsNull() static void JoinOnNull() { - + // using (AdventureWorksEntities context = new AdventureWorksEntities()) { @@ -316,10 +316,10 @@ static void JoinOnNull() ObjectSet details = context.SalesOrderDetails; var query = - from order in orders - join detail in details - on order.SalesOrderID - equals detail.SalesOrderID + from order in orders + join detail in details + on order.SalesOrderID + equals detail.SalesOrderID where order.ShipDate == null select order.SalesOrderID; @@ -478,9 +478,9 @@ public static void NavPropLoadError() foreach (Contact contact in contacts) { Console.WriteLine("Name: {0}, {1}", contact.LastName, contact.FirstName); - - // Throws a EntityCommandExecutionException if - // MultipleActiveResultSets is set to False in the + + // Throws a EntityCommandExecutionException if + // MultipleActiveResultSets is set to False in the // connection string. contact.SalesOrderHeaders.Load(); @@ -512,7 +512,7 @@ from s in context.SalesOrderHeaders Console.WriteLine("Sales order info:"); foreach (int orderNumber in salesInfo) { - Console.WriteLine("Order number: " + orderNumber); + Console.WriteLine("Order number: " + orderNumber); } } // @@ -520,7 +520,7 @@ from s in context.SalesOrderHeaders public static void LiteralParameter1() { - + using (AdventureWorksEntities context = new AdventureWorksEntities()) { // @@ -544,11 +544,11 @@ public static void MethodParameterExample(int orderID) { using (AdventureWorksEntities context = new AdventureWorksEntities()) { - + IQueryable salesInfo = from s in context.SalesOrderHeaders where s.SalesOrderID == orderID - select s; + select s; foreach (SalesOrderHeader sale in salesInfo) { @@ -559,7 +559,7 @@ from s in context.SalesOrderHeaders // public static void NullCastToString() - { + { using (AdventureWorksEntities context = new AdventureWorksEntities()) { // @@ -573,7 +573,7 @@ from c in context.Contacts { Console.WriteLine("Name: {0}", contact.LastName); } - } + } } public static void CastToNullable() @@ -592,7 +592,7 @@ from product in context.Products { Console.WriteLine("Name: {0}", p.Name); } - } + } } public static void ConstructorForLiteral() @@ -611,7 +611,7 @@ from product in context.Products { Console.WriteLine("Name: {0}", p.Name); } - } + } } public static void CanonicalFuncVsCLRBaseType() @@ -639,7 +639,7 @@ public static void ConvertExpression() { var sales = from sale in context.SalesOrderDetails where sale.OrderQty > orderQty - select new { Sale = sale, TotalValue = (decimal)sale.OrderQty * sale.UnitPrice }; + select new { Sale = sale, TotalValue = (decimal)sale.OrderQty * sale.UnitPrice }; foreach (var s in sales) { @@ -872,7 +872,7 @@ static void SBUDT544351() Console.WriteLine(productName); } - // In this query, the ordering is preserved because + // In this query, the ordering is preserved because // OrderByDescending is called after Distinct. IQueryable productsList2 = context.Products .Select(p => p.Name) @@ -913,7 +913,7 @@ static void SBUDT496552A() using (AdventureWorksEntities context = new AdventureWorksEntities()) { // Return all contacts, ordered by last name. The OrderBy before - // the Where produces a nested query when translated to + // the Where produces a nested query when translated to // canonical command trees and the ordering by last name is lost. IQueryable contacts = context.Contacts .OrderBy(x => x.LastName) @@ -1060,7 +1060,7 @@ public static void SBUDT555877() } // } - + # endregion # region "How to examples" public static void QueryReturnsPrimitiveValue() @@ -1176,32 +1176,32 @@ static void FunctionMappingWorkAround() # region Compiled Query Examples // - static readonly Func> s_compiledQuery1 = + static readonly Func> s_compiledQuery1 = CompiledQuery.Compile>( ctx => ctx.SalesOrderHeaders); static void CompiledQuery1_MQ() { - + using (AdventureWorksEntities context = new AdventureWorksEntities()) { IQueryable orders = s_compiledQuery1.Invoke(context); foreach (SalesOrderHeader order in orders) Console.WriteLine(order.SalesOrderID); - } + } } // // - static readonly Func> s_compiledQuery2 = + static readonly Func> s_compiledQuery2 = CompiledQuery.Compile>( (ctx, total) => from order in ctx.SalesOrderHeaders where order.TotalDue >= total select order); static void CompiledQuery2() - { + { using (AdventureWorksEntities context = new AdventureWorksEntities()) { Decimal totalDue = 200.00M; @@ -1215,11 +1215,11 @@ static void CompiledQuery2() order.OrderDate, order.TotalDue); } - } + } } // - static readonly Func> s_compiledQuery2MQ = + static readonly Func> s_compiledQuery2MQ = CompiledQuery.Compile>( (ctx, total) => ctx.SalesOrderHeaders .Where(s => s.TotalDue >= total) @@ -1241,7 +1241,7 @@ static void CompiledQuery2_MQ() order.OrderDate, order.TotalDue); } - } + } } // @@ -1251,23 +1251,23 @@ static void CompiledQuery2_MQ() static void CompiledQuery3_MQ() { - + using (AdventureWorksEntities context = new AdventureWorksEntities()) { Decimal averageProductPrice = s_compiledQuery3MQ.Invoke(context); Console.WriteLine("The average of the product list prices is $: {0}", averageProductPrice); - } + } } // // - static readonly Func s_compiledQuery4MQ = + static readonly Func s_compiledQuery4MQ = CompiledQuery.Compile( (ctx, name) => ctx.Contacts.First(contact => contact.EmailAddress.StartsWith(name))); static void CompiledQuery4_MQ() - { + { using (AdventureWorksEntities context = new AdventureWorksEntities()) { string contactName = "caroline"; @@ -1275,23 +1275,23 @@ static void CompiledQuery4_MQ() Console.WriteLine("An email address starting with 'caroline': {0}", foundContact.EmailAddress); - } + } } // // - static readonly Func> s_compiledQuery5 = + static readonly Func> s_compiledQuery5 = CompiledQuery.Compile>( (ctx, orderDate, totalDue) => from product in ctx.SalesOrderHeaders - where product.OrderDate > orderDate + where product.OrderDate > orderDate && product.TotalDue < totalDue orderby product.OrderDate select product); static void CompiledQuery5() - { + { using (AdventureWorksEntities context = new AdventureWorksEntities()) - { + { DateTime date = new DateTime(2003, 3, 8); Decimal amountDue = 300.00M; @@ -1301,7 +1301,7 @@ static void CompiledQuery5() { Console.WriteLine("ID: {0} Order date: {1} Total due: {2}", order.SalesOrderID, order.OrderDate, order.TotalDue); } - } + } } // @@ -1336,15 +1336,15 @@ struct MyParams // // - static Func> s_compiledQuery = + static Func> s_compiledQuery = CompiledQuery.Compile>( (ctx, myparams) => from sale in ctx.SalesOrderHeaders - where sale.ShipDate > myparams.startDate && sale.ShipDate < myparams.endDate - && sale.TotalDue > myparams.totalDue + where sale.ShipDate > myparams.startDate && sale.ShipDate < myparams.endDate + && sale.TotalDue > myparams.totalDue select sale); static void CompiledQuery7() { - + using (AdventureWorksEntities context = new AdventureWorksEntities()) { MyParams myParams = new MyParams(); @@ -1360,7 +1360,7 @@ static void CompiledQuery7() Console.WriteLine("Ship date: {0}", sale.ShipDate); Console.WriteLine("Total due: {0}", sale.TotalDue); } - } + } } // # endregion diff --git a/samples/snippets/csharp/VS_Snippets_Data/DP L2E Conceptual Examples/CS/adventureworksmodel.designer.cs b/samples/snippets/csharp/VS_Snippets_Data/DP L2E Conceptual Examples/CS/adventureworksmodel.designer.cs index af5fa53f3eccf..c694d6ede8a7b 100644 --- a/samples/snippets/csharp/VS_Snippets_Data/DP L2E Conceptual Examples/CS/adventureworksmodel.designer.cs +++ b/samples/snippets/csharp/VS_Snippets_Data/DP L2E Conceptual Examples/CS/adventureworksmodel.designer.cs @@ -40,7 +40,7 @@ public AdventureWorksEntities() : base("name=AdventureWorksEntities", "Adventure { OnContextCreated(); } - + /// /// Initialize a new AdventureWorksEntities object. /// @@ -48,7 +48,7 @@ public AdventureWorksEntities(string connectionString) : base(connectionString, { OnContextCreated(); } - + /// /// Initialize a new AdventureWorksEntities object. /// @@ -57,11 +57,11 @@ public AdventureWorksEntities(EntityConnection connection) : base(connection, "A OnContextCreated(); } #endregion - + #region Partial Methods partial void OnContextCreated(); #endregion - + #region ObjectSet Properties /// /// No Metadata Documentation available. @@ -78,7 +78,7 @@ public ObjectSet
Addresses } } private ObjectSet
_Addresses; - + /// /// No Metadata Documentation available. /// @@ -94,7 +94,7 @@ public ObjectSet Contacts } } private ObjectSet _Contacts; - + /// /// No Metadata Documentation available. /// @@ -110,7 +110,7 @@ public ObjectSet Products } } private ObjectSet _Products; - + /// /// No Metadata Documentation available. /// @@ -126,7 +126,7 @@ public ObjectSet SalesOrderDetails } } private ObjectSet _SalesOrderDetails; - + /// /// No Metadata Documentation available. /// @@ -142,10 +142,10 @@ public ObjectSet SalesOrderHeaders } } private ObjectSet _SalesOrderHeaders; - + #endregion #region AddTo Methods - + /// /// Deprecated Method for adding a new object to the Addresses EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// @@ -153,7 +153,7 @@ public void AddToAddresses(Address address) { base.AddObject("Addresses", address); } - + /// /// Deprecated Method for adding a new object to the Contacts EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// @@ -161,7 +161,7 @@ public void AddToContacts(Contact contact) { base.AddObject("Contacts", contact); } - + /// /// Deprecated Method for adding a new object to the Products EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// @@ -169,7 +169,7 @@ public void AddToProducts(Product product) { base.AddObject("Products", product); } - + /// /// Deprecated Method for adding a new object to the SalesOrderDetails EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// @@ -177,7 +177,7 @@ public void AddToSalesOrderDetails(SalesOrderDetail salesOrderDetail) { base.AddObject("SalesOrderDetails", salesOrderDetail); } - + /// /// Deprecated Method for adding a new object to the SalesOrderHeaders EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// @@ -187,10 +187,10 @@ public void AddToSalesOrderHeaders(SalesOrderHeader salesOrderHeader) } #endregion } - + #endregion - - + + #region Entities /// /// No Metadata Documentation available. @@ -215,19 +215,19 @@ public static Address CreateAddress(global::System.Int32 addressID, global::Syst { Address address = new Address(); address.AddressID = addressID; - + address.AddressLine1 = addressLine1; - + address.City = city; - + address.StateProvinceID = stateProvinceID; - + address.PostalCode = postalCode; - + address.rowguid = rowguid; - + address.ModifiedDate = modifiedDate; - + return address; } #endregion @@ -255,12 +255,12 @@ public static Address CreateAddress(global::System.Int32 addressID, global::Syst OnAddressIDChanged(); } } - + } private global::System.Int32 _AddressID; partial void OnAddressIDChanging(global::System.Int32 value); partial void OnAddressIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -280,12 +280,12 @@ public static Address CreateAddress(global::System.Int32 addressID, global::Syst ReportPropertyChanged("AddressLine1"); OnAddressLine1Changed(); } - + } private global::System.String _AddressLine1; partial void OnAddressLine1Changing(global::System.String value); partial void OnAddressLine1Changed(); - + /// /// No Metadata Documentation available. /// @@ -305,12 +305,12 @@ public static Address CreateAddress(global::System.Int32 addressID, global::Syst ReportPropertyChanged("AddressLine2"); OnAddressLine2Changed(); } - + } private global::System.String _AddressLine2; partial void OnAddressLine2Changing(global::System.String value); partial void OnAddressLine2Changed(); - + /// /// No Metadata Documentation available. /// @@ -330,12 +330,12 @@ public static Address CreateAddress(global::System.Int32 addressID, global::Syst ReportPropertyChanged("City"); OnCityChanged(); } - + } private global::System.String _City; partial void OnCityChanging(global::System.String value); partial void OnCityChanged(); - + /// /// No Metadata Documentation available. /// @@ -355,12 +355,12 @@ public static Address CreateAddress(global::System.Int32 addressID, global::Syst ReportPropertyChanged("StateProvinceID"); OnStateProvinceIDChanged(); } - + } private global::System.Int32 _StateProvinceID; partial void OnStateProvinceIDChanging(global::System.Int32 value); partial void OnStateProvinceIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -380,12 +380,12 @@ public static Address CreateAddress(global::System.Int32 addressID, global::Syst ReportPropertyChanged("PostalCode"); OnPostalCodeChanged(); } - + } private global::System.String _PostalCode; partial void OnPostalCodeChanging(global::System.String value); partial void OnPostalCodeChanged(); - + /// /// No Metadata Documentation available. /// @@ -405,12 +405,12 @@ public static Address CreateAddress(global::System.Int32 addressID, global::Syst ReportPropertyChanged("rowguid"); OnrowguidChanged(); } - + } private global::System.Guid _rowguid; partial void OnrowguidChanging(global::System.Guid value); partial void OnrowguidChanged(); - + /// /// No Metadata Documentation available. /// @@ -430,14 +430,14 @@ public static Address CreateAddress(global::System.Int32 addressID, global::Syst ReportPropertyChanged("ModifiedDate"); OnModifiedDateChanged(); } - + } private global::System.DateTime _ModifiedDate; partial void OnModifiedDateChanging(global::System.DateTime value); partial void OnModifiedDateChanged(); - + #endregion - + #region Navigation Properties /// /// No Metadata Documentation available. @@ -445,7 +445,7 @@ public static Address CreateAddress(global::System.Int32 addressID, global::Syst [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Address_BillToAddressID", "SalesOrderHeader")] + [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Address_BillToAddressID", "SalesOrderHeader")] public EntityCollection SalesOrderHeaders { get @@ -466,7 +466,7 @@ public EntityCollection SalesOrderHeaders [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Address_ShipToAddressID", "SalesOrderHeader")] + [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Address_ShipToAddressID", "SalesOrderHeader")] public EntityCollection SalesOrderHeaders1 { get @@ -483,7 +483,7 @@ public EntityCollection SalesOrderHeaders1 } #endregion } - + /// /// No Metadata Documentation available. /// @@ -509,23 +509,23 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst { Contact contact = new Contact(); contact.ContactID = contactID; - + contact.NameStyle = nameStyle; - + contact.FirstName = firstName; - + contact.LastName = lastName; - + contact.EmailPromotion = emailPromotion; - + contact.PasswordHash = passwordHash; - + contact.PasswordSalt = passwordSalt; - + contact.rowguid = rowguid; - + contact.ModifiedDate = modifiedDate; - + return contact; } #endregion @@ -553,12 +553,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst OnContactIDChanged(); } } - + } private global::System.Int32 _ContactID; partial void OnContactIDChanging(global::System.Int32 value); partial void OnContactIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -578,12 +578,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("NameStyle"); OnNameStyleChanged(); } - + } private global::System.Boolean _NameStyle; partial void OnNameStyleChanging(global::System.Boolean value); partial void OnNameStyleChanged(); - + /// /// No Metadata Documentation available. /// @@ -603,12 +603,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("Title"); OnTitleChanged(); } - + } private global::System.String _Title; partial void OnTitleChanging(global::System.String value); partial void OnTitleChanged(); - + /// /// No Metadata Documentation available. /// @@ -628,12 +628,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("FirstName"); OnFirstNameChanged(); } - + } private global::System.String _FirstName; partial void OnFirstNameChanging(global::System.String value); partial void OnFirstNameChanged(); - + /// /// No Metadata Documentation available. /// @@ -653,12 +653,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("MiddleName"); OnMiddleNameChanged(); } - + } private global::System.String _MiddleName; partial void OnMiddleNameChanging(global::System.String value); partial void OnMiddleNameChanged(); - + /// /// No Metadata Documentation available. /// @@ -678,12 +678,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("LastName"); OnLastNameChanged(); } - + } private global::System.String _LastName; partial void OnLastNameChanging(global::System.String value); partial void OnLastNameChanged(); - + /// /// No Metadata Documentation available. /// @@ -703,12 +703,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("Suffix"); OnSuffixChanged(); } - + } private global::System.String _Suffix; partial void OnSuffixChanging(global::System.String value); partial void OnSuffixChanged(); - + /// /// No Metadata Documentation available. /// @@ -728,12 +728,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("EmailAddress"); OnEmailAddressChanged(); } - + } private global::System.String _EmailAddress; partial void OnEmailAddressChanging(global::System.String value); partial void OnEmailAddressChanged(); - + /// /// No Metadata Documentation available. /// @@ -753,12 +753,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("EmailPromotion"); OnEmailPromotionChanged(); } - + } private global::System.Int32 _EmailPromotion; partial void OnEmailPromotionChanging(global::System.Int32 value); partial void OnEmailPromotionChanged(); - + /// /// No Metadata Documentation available. /// @@ -778,12 +778,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("Phone"); OnPhoneChanged(); } - + } private global::System.String _Phone; partial void OnPhoneChanging(global::System.String value); partial void OnPhoneChanged(); - + /// /// No Metadata Documentation available. /// @@ -803,12 +803,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("PasswordHash"); OnPasswordHashChanged(); } - + } private global::System.String _PasswordHash; partial void OnPasswordHashChanging(global::System.String value); partial void OnPasswordHashChanged(); - + /// /// No Metadata Documentation available. /// @@ -828,12 +828,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("PasswordSalt"); OnPasswordSaltChanged(); } - + } private global::System.String _PasswordSalt; partial void OnPasswordSaltChanging(global::System.String value); partial void OnPasswordSaltChanged(); - + /// /// No Metadata Documentation available. /// @@ -853,12 +853,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("AdditionalContactInfo"); OnAdditionalContactInfoChanged(); } - + } private global::System.String _AdditionalContactInfo; partial void OnAdditionalContactInfoChanging(global::System.String value); partial void OnAdditionalContactInfoChanged(); - + /// /// No Metadata Documentation available. /// @@ -878,12 +878,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("rowguid"); OnrowguidChanged(); } - + } private global::System.Guid _rowguid; partial void OnrowguidChanging(global::System.Guid value); partial void OnrowguidChanged(); - + /// /// No Metadata Documentation available. /// @@ -903,14 +903,14 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("ModifiedDate"); OnModifiedDateChanged(); } - + } private global::System.DateTime _ModifiedDate; partial void OnModifiedDateChanging(global::System.DateTime value); partial void OnModifiedDateChanged(); - + #endregion - + #region Navigation Properties /// /// No Metadata Documentation available. @@ -918,7 +918,7 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Contact_ContactID", "SalesOrderHeader")] + [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Contact_ContactID", "SalesOrderHeader")] public EntityCollection SalesOrderHeaders { get @@ -935,7 +935,7 @@ public EntityCollection SalesOrderHeaders } #endregion } - + /// /// No Metadata Documentation available. /// @@ -965,31 +965,31 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst { Product product = new Product(); product.ProductID = productID; - + product.Name = name; - + product.ProductNumber = productNumber; - + product.MakeFlag = makeFlag; - + product.FinishedGoodsFlag = finishedGoodsFlag; - + product.SafetyStockLevel = safetyStockLevel; - + product.ReorderPoint = reorderPoint; - + product.StandardCost = standardCost; - + product.ListPrice = listPrice; - + product.DaysToManufacture = daysToManufacture; - + product.SellStartDate = sellStartDate; - + product.rowguid = rowguid; - + product.ModifiedDate = modifiedDate; - + return product; } #endregion @@ -1017,12 +1017,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst OnProductIDChanged(); } } - + } private global::System.Int32 _ProductID; partial void OnProductIDChanging(global::System.Int32 value); partial void OnProductIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1042,12 +1042,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("Name"); OnNameChanged(); } - + } private global::System.String _Name; partial void OnNameChanging(global::System.String value); partial void OnNameChanged(); - + /// /// No Metadata Documentation available. /// @@ -1067,12 +1067,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("ProductNumber"); OnProductNumberChanged(); } - + } private global::System.String _ProductNumber; partial void OnProductNumberChanging(global::System.String value); partial void OnProductNumberChanged(); - + /// /// No Metadata Documentation available. /// @@ -1092,12 +1092,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("MakeFlag"); OnMakeFlagChanged(); } - + } private global::System.Boolean _MakeFlag; partial void OnMakeFlagChanging(global::System.Boolean value); partial void OnMakeFlagChanged(); - + /// /// No Metadata Documentation available. /// @@ -1117,12 +1117,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("FinishedGoodsFlag"); OnFinishedGoodsFlagChanged(); } - + } private global::System.Boolean _FinishedGoodsFlag; partial void OnFinishedGoodsFlagChanging(global::System.Boolean value); partial void OnFinishedGoodsFlagChanged(); - + /// /// No Metadata Documentation available. /// @@ -1142,12 +1142,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("Color"); OnColorChanged(); } - + } private global::System.String _Color; partial void OnColorChanging(global::System.String value); partial void OnColorChanged(); - + /// /// No Metadata Documentation available. /// @@ -1167,12 +1167,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("SafetyStockLevel"); OnSafetyStockLevelChanged(); } - + } private global::System.Int16 _SafetyStockLevel; partial void OnSafetyStockLevelChanging(global::System.Int16 value); partial void OnSafetyStockLevelChanged(); - + /// /// No Metadata Documentation available. /// @@ -1192,12 +1192,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("ReorderPoint"); OnReorderPointChanged(); } - + } private global::System.Int16 _ReorderPoint; partial void OnReorderPointChanging(global::System.Int16 value); partial void OnReorderPointChanged(); - + /// /// No Metadata Documentation available. /// @@ -1217,12 +1217,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("StandardCost"); OnStandardCostChanged(); } - + } private global::System.Decimal _StandardCost; partial void OnStandardCostChanging(global::System.Decimal value); partial void OnStandardCostChanged(); - + /// /// No Metadata Documentation available. /// @@ -1242,12 +1242,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("ListPrice"); OnListPriceChanged(); } - + } private global::System.Decimal _ListPrice; partial void OnListPriceChanging(global::System.Decimal value); partial void OnListPriceChanged(); - + /// /// No Metadata Documentation available. /// @@ -1267,12 +1267,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("Size"); OnSizeChanged(); } - + } private global::System.String _Size; partial void OnSizeChanging(global::System.String value); partial void OnSizeChanged(); - + /// /// No Metadata Documentation available. /// @@ -1292,12 +1292,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("SizeUnitMeasureCode"); OnSizeUnitMeasureCodeChanged(); } - + } private global::System.String _SizeUnitMeasureCode; partial void OnSizeUnitMeasureCodeChanging(global::System.String value); partial void OnSizeUnitMeasureCodeChanged(); - + /// /// No Metadata Documentation available. /// @@ -1317,12 +1317,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("WeightUnitMeasureCode"); OnWeightUnitMeasureCodeChanged(); } - + } private global::System.String _WeightUnitMeasureCode; partial void OnWeightUnitMeasureCodeChanging(global::System.String value); partial void OnWeightUnitMeasureCodeChanged(); - + /// /// No Metadata Documentation available. /// @@ -1342,12 +1342,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("Weight"); OnWeightChanged(); } - + } private Nullable _Weight; partial void OnWeightChanging(Nullable value); partial void OnWeightChanged(); - + /// /// No Metadata Documentation available. /// @@ -1367,12 +1367,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("DaysToManufacture"); OnDaysToManufactureChanged(); } - + } private global::System.Int32 _DaysToManufacture; partial void OnDaysToManufactureChanging(global::System.Int32 value); partial void OnDaysToManufactureChanged(); - + /// /// No Metadata Documentation available. /// @@ -1392,12 +1392,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("ProductLine"); OnProductLineChanged(); } - + } private global::System.String _ProductLine; partial void OnProductLineChanging(global::System.String value); partial void OnProductLineChanged(); - + /// /// No Metadata Documentation available. /// @@ -1417,12 +1417,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("Class"); OnClassChanged(); } - + } private global::System.String _Class; partial void OnClassChanging(global::System.String value); partial void OnClassChanged(); - + /// /// No Metadata Documentation available. /// @@ -1442,12 +1442,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("Style"); OnStyleChanged(); } - + } private global::System.String _Style; partial void OnStyleChanging(global::System.String value); partial void OnStyleChanged(); - + /// /// No Metadata Documentation available. /// @@ -1467,12 +1467,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("ProductSubcategoryID"); OnProductSubcategoryIDChanged(); } - + } private Nullable _ProductSubcategoryID; partial void OnProductSubcategoryIDChanging(Nullable value); partial void OnProductSubcategoryIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1492,12 +1492,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("ProductModelID"); OnProductModelIDChanged(); } - + } private Nullable _ProductModelID; partial void OnProductModelIDChanging(Nullable value); partial void OnProductModelIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1517,12 +1517,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("SellStartDate"); OnSellStartDateChanged(); } - + } private global::System.DateTime _SellStartDate; partial void OnSellStartDateChanging(global::System.DateTime value); partial void OnSellStartDateChanged(); - + /// /// No Metadata Documentation available. /// @@ -1542,12 +1542,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("SellEndDate"); OnSellEndDateChanged(); } - + } private Nullable _SellEndDate; partial void OnSellEndDateChanging(Nullable value); partial void OnSellEndDateChanged(); - + /// /// No Metadata Documentation available. /// @@ -1567,12 +1567,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("DiscontinuedDate"); OnDiscontinuedDateChanged(); } - + } private Nullable _DiscontinuedDate; partial void OnDiscontinuedDateChanging(Nullable value); partial void OnDiscontinuedDateChanged(); - + /// /// No Metadata Documentation available. /// @@ -1592,12 +1592,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("rowguid"); OnrowguidChanged(); } - + } private global::System.Guid _rowguid; partial void OnrowguidChanging(global::System.Guid value); partial void OnrowguidChanged(); - + /// /// No Metadata Documentation available. /// @@ -1617,16 +1617,16 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("ModifiedDate"); OnModifiedDateChanged(); } - + } private global::System.DateTime _ModifiedDate; partial void OnModifiedDateChanging(global::System.DateTime value); partial void OnModifiedDateChanged(); - + #endregion - + } - + /// /// No Metadata Documentation available. /// @@ -1653,25 +1653,25 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales { SalesOrderDetail salesOrderDetail = new SalesOrderDetail(); salesOrderDetail.SalesOrderID = salesOrderID; - + salesOrderDetail.SalesOrderDetailID = salesOrderDetailID; - + salesOrderDetail.OrderQty = orderQty; - + salesOrderDetail.ProductID = productID; - + salesOrderDetail.SpecialOfferID = specialOfferID; - + salesOrderDetail.UnitPrice = unitPrice; - + salesOrderDetail.UnitPriceDiscount = unitPriceDiscount; - + salesOrderDetail.LineTotal = lineTotal; - + salesOrderDetail.rowguid = rowguid; - + salesOrderDetail.ModifiedDate = modifiedDate; - + return salesOrderDetail; } #endregion @@ -1699,12 +1699,12 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales OnSalesOrderIDChanged(); } } - + } private global::System.Int32 _SalesOrderID; partial void OnSalesOrderIDChanging(global::System.Int32 value); partial void OnSalesOrderIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1727,12 +1727,12 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales OnSalesOrderDetailIDChanged(); } } - + } private global::System.Int32 _SalesOrderDetailID; partial void OnSalesOrderDetailIDChanging(global::System.Int32 value); partial void OnSalesOrderDetailIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1752,12 +1752,12 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales ReportPropertyChanged("CarrierTrackingNumber"); OnCarrierTrackingNumberChanged(); } - + } private global::System.String _CarrierTrackingNumber; partial void OnCarrierTrackingNumberChanging(global::System.String value); partial void OnCarrierTrackingNumberChanged(); - + /// /// No Metadata Documentation available. /// @@ -1777,12 +1777,12 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales ReportPropertyChanged("OrderQty"); OnOrderQtyChanged(); } - + } private global::System.Int16 _OrderQty; partial void OnOrderQtyChanging(global::System.Int16 value); partial void OnOrderQtyChanged(); - + /// /// No Metadata Documentation available. /// @@ -1802,12 +1802,12 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales ReportPropertyChanged("ProductID"); OnProductIDChanged(); } - + } private global::System.Int32 _ProductID; partial void OnProductIDChanging(global::System.Int32 value); partial void OnProductIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1827,12 +1827,12 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales ReportPropertyChanged("SpecialOfferID"); OnSpecialOfferIDChanged(); } - + } private global::System.Int32 _SpecialOfferID; partial void OnSpecialOfferIDChanging(global::System.Int32 value); partial void OnSpecialOfferIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1852,12 +1852,12 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales ReportPropertyChanged("UnitPrice"); OnUnitPriceChanged(); } - + } private global::System.Decimal _UnitPrice; partial void OnUnitPriceChanging(global::System.Decimal value); partial void OnUnitPriceChanged(); - + /// /// No Metadata Documentation available. /// @@ -1877,12 +1877,12 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales ReportPropertyChanged("UnitPriceDiscount"); OnUnitPriceDiscountChanged(); } - + } private global::System.Decimal _UnitPriceDiscount; partial void OnUnitPriceDiscountChanging(global::System.Decimal value); partial void OnUnitPriceDiscountChanged(); - + /// /// No Metadata Documentation available. /// @@ -1902,12 +1902,12 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales ReportPropertyChanged("LineTotal"); OnLineTotalChanged(); } - + } private global::System.Decimal _LineTotal; partial void OnLineTotalChanging(global::System.Decimal value); partial void OnLineTotalChanged(); - + /// /// No Metadata Documentation available. /// @@ -1927,12 +1927,12 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales ReportPropertyChanged("rowguid"); OnrowguidChanged(); } - + } private global::System.Guid _rowguid; partial void OnrowguidChanging(global::System.Guid value); partial void OnrowguidChanged(); - + /// /// No Metadata Documentation available. /// @@ -1952,14 +1952,14 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales ReportPropertyChanged("ModifiedDate"); OnModifiedDateChanged(); } - + } private global::System.DateTime _ModifiedDate; partial void OnModifiedDateChanging(global::System.DateTime value); partial void OnModifiedDateChanged(); - + #endregion - + #region Navigation Properties /// /// No Metadata Documentation available. @@ -1967,7 +1967,7 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderDetail_SalesOrderHeader_SalesOrderID", "SalesOrderHeader")] + [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderDetail_SalesOrderHeader_SalesOrderID", "SalesOrderHeader")] public SalesOrderHeader SalesOrderHeader { get @@ -2000,7 +2000,7 @@ public EntityReference SalesOrderHeaderReference } #endregion } - + /// /// No Metadata Documentation available. /// @@ -2035,41 +2035,41 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales { SalesOrderHeader salesOrderHeader = new SalesOrderHeader(); salesOrderHeader.SalesOrderID = salesOrderID; - + salesOrderHeader.RevisionNumber = revisionNumber; - + salesOrderHeader.OrderDate = orderDate; - + salesOrderHeader.DueDate = dueDate; - + salesOrderHeader.Status = status; - + salesOrderHeader.OnlineOrderFlag = onlineOrderFlag; - + salesOrderHeader.SalesOrderNumber = salesOrderNumber; - + salesOrderHeader.CustomerID = customerID; - + salesOrderHeader.ContactID = contactID; - + salesOrderHeader.BillToAddressID = billToAddressID; - + salesOrderHeader.ShipToAddressID = shipToAddressID; - + salesOrderHeader.ShipMethodID = shipMethodID; - + salesOrderHeader.SubTotal = subTotal; - + salesOrderHeader.TaxAmt = taxAmt; - + salesOrderHeader.Freight = freight; - + salesOrderHeader.TotalDue = totalDue; - + salesOrderHeader.rowguid = rowguid; - + salesOrderHeader.ModifiedDate = modifiedDate; - + return salesOrderHeader; } #endregion @@ -2097,12 +2097,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales OnSalesOrderIDChanged(); } } - + } private global::System.Int32 _SalesOrderID; partial void OnSalesOrderIDChanging(global::System.Int32 value); partial void OnSalesOrderIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2122,12 +2122,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("RevisionNumber"); OnRevisionNumberChanged(); } - + } private global::System.Byte _RevisionNumber; partial void OnRevisionNumberChanging(global::System.Byte value); partial void OnRevisionNumberChanged(); - + /// /// No Metadata Documentation available. /// @@ -2147,12 +2147,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("OrderDate"); OnOrderDateChanged(); } - + } private global::System.DateTime _OrderDate; partial void OnOrderDateChanging(global::System.DateTime value); partial void OnOrderDateChanged(); - + /// /// No Metadata Documentation available. /// @@ -2172,12 +2172,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("DueDate"); OnDueDateChanged(); } - + } private global::System.DateTime _DueDate; partial void OnDueDateChanging(global::System.DateTime value); partial void OnDueDateChanged(); - + /// /// No Metadata Documentation available. /// @@ -2197,12 +2197,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("ShipDate"); OnShipDateChanged(); } - + } private Nullable _ShipDate; partial void OnShipDateChanging(Nullable value); partial void OnShipDateChanged(); - + /// /// No Metadata Documentation available. /// @@ -2222,12 +2222,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("Status"); OnStatusChanged(); } - + } private global::System.Byte _Status; partial void OnStatusChanging(global::System.Byte value); partial void OnStatusChanged(); - + /// /// No Metadata Documentation available. /// @@ -2247,12 +2247,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("OnlineOrderFlag"); OnOnlineOrderFlagChanged(); } - + } private global::System.Boolean _OnlineOrderFlag; partial void OnOnlineOrderFlagChanging(global::System.Boolean value); partial void OnOnlineOrderFlagChanged(); - + /// /// No Metadata Documentation available. /// @@ -2272,12 +2272,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("SalesOrderNumber"); OnSalesOrderNumberChanged(); } - + } private global::System.String _SalesOrderNumber; partial void OnSalesOrderNumberChanging(global::System.String value); partial void OnSalesOrderNumberChanged(); - + /// /// No Metadata Documentation available. /// @@ -2297,12 +2297,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("PurchaseOrderNumber"); OnPurchaseOrderNumberChanged(); } - + } private global::System.String _PurchaseOrderNumber; partial void OnPurchaseOrderNumberChanging(global::System.String value); partial void OnPurchaseOrderNumberChanged(); - + /// /// No Metadata Documentation available. /// @@ -2322,12 +2322,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("AccountNumber"); OnAccountNumberChanged(); } - + } private global::System.String _AccountNumber; partial void OnAccountNumberChanging(global::System.String value); partial void OnAccountNumberChanged(); - + /// /// No Metadata Documentation available. /// @@ -2347,12 +2347,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("CustomerID"); OnCustomerIDChanged(); } - + } private global::System.Int32 _CustomerID; partial void OnCustomerIDChanging(global::System.Int32 value); partial void OnCustomerIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2372,12 +2372,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("ContactID"); OnContactIDChanged(); } - + } private global::System.Int32 _ContactID; partial void OnContactIDChanging(global::System.Int32 value); partial void OnContactIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2397,12 +2397,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("SalesPersonID"); OnSalesPersonIDChanged(); } - + } private Nullable _SalesPersonID; partial void OnSalesPersonIDChanging(Nullable value); partial void OnSalesPersonIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2422,12 +2422,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("TerritoryID"); OnTerritoryIDChanged(); } - + } private Nullable _TerritoryID; partial void OnTerritoryIDChanging(Nullable value); partial void OnTerritoryIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2447,12 +2447,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("BillToAddressID"); OnBillToAddressIDChanged(); } - + } private global::System.Int32 _BillToAddressID; partial void OnBillToAddressIDChanging(global::System.Int32 value); partial void OnBillToAddressIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2472,12 +2472,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("ShipToAddressID"); OnShipToAddressIDChanged(); } - + } private global::System.Int32 _ShipToAddressID; partial void OnShipToAddressIDChanging(global::System.Int32 value); partial void OnShipToAddressIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2497,12 +2497,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("ShipMethodID"); OnShipMethodIDChanged(); } - + } private global::System.Int32 _ShipMethodID; partial void OnShipMethodIDChanging(global::System.Int32 value); partial void OnShipMethodIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2522,12 +2522,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("CreditCardID"); OnCreditCardIDChanged(); } - + } private Nullable _CreditCardID; partial void OnCreditCardIDChanging(Nullable value); partial void OnCreditCardIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2547,12 +2547,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("CreditCardApprovalCode"); OnCreditCardApprovalCodeChanged(); } - + } private global::System.String _CreditCardApprovalCode; partial void OnCreditCardApprovalCodeChanging(global::System.String value); partial void OnCreditCardApprovalCodeChanged(); - + /// /// No Metadata Documentation available. /// @@ -2572,12 +2572,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("CurrencyRateID"); OnCurrencyRateIDChanged(); } - + } private Nullable _CurrencyRateID; partial void OnCurrencyRateIDChanging(Nullable value); partial void OnCurrencyRateIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2597,12 +2597,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("SubTotal"); OnSubTotalChanged(); } - + } private global::System.Decimal _SubTotal; partial void OnSubTotalChanging(global::System.Decimal value); partial void OnSubTotalChanged(); - + /// /// No Metadata Documentation available. /// @@ -2622,12 +2622,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("TaxAmt"); OnTaxAmtChanged(); } - + } private global::System.Decimal _TaxAmt; partial void OnTaxAmtChanging(global::System.Decimal value); partial void OnTaxAmtChanged(); - + /// /// No Metadata Documentation available. /// @@ -2647,12 +2647,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("Freight"); OnFreightChanged(); } - + } private global::System.Decimal _Freight; partial void OnFreightChanging(global::System.Decimal value); partial void OnFreightChanged(); - + /// /// No Metadata Documentation available. /// @@ -2672,12 +2672,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("TotalDue"); OnTotalDueChanged(); } - + } private global::System.Decimal _TotalDue; partial void OnTotalDueChanging(global::System.Decimal value); partial void OnTotalDueChanged(); - + /// /// No Metadata Documentation available. /// @@ -2697,12 +2697,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("Comment"); OnCommentChanged(); } - + } private global::System.String _Comment; partial void OnCommentChanging(global::System.String value); partial void OnCommentChanged(); - + /// /// No Metadata Documentation available. /// @@ -2722,12 +2722,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("rowguid"); OnrowguidChanged(); } - + } private global::System.Guid _rowguid; partial void OnrowguidChanging(global::System.Guid value); partial void OnrowguidChanged(); - + /// /// No Metadata Documentation available. /// @@ -2747,14 +2747,14 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("ModifiedDate"); OnModifiedDateChanged(); } - + } private global::System.DateTime _ModifiedDate; partial void OnModifiedDateChanging(global::System.DateTime value); partial void OnModifiedDateChanged(); - + #endregion - + #region Navigation Properties /// /// No Metadata Documentation available. @@ -2762,7 +2762,7 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Address_BillToAddressID", "Address")] + [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Address_BillToAddressID", "Address")] public Address Address { get @@ -2799,7 +2799,7 @@ public EntityReference
AddressReference [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Address_ShipToAddressID", "Address")] + [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Address_ShipToAddressID", "Address")] public Address Address1 { get @@ -2836,7 +2836,7 @@ public EntityReference
Address1Reference [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Contact_ContactID", "Contact")] + [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Contact_ContactID", "Contact")] public Contact Contact { get @@ -2873,7 +2873,7 @@ public EntityReference ContactReference [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderDetail_SalesOrderHeader_SalesOrderID", "SalesOrderDetail")] + [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderDetail_SalesOrderHeader_SalesOrderID", "SalesOrderDetail")] public EntityCollection SalesOrderDetails { get @@ -2890,7 +2890,7 @@ public EntityCollection SalesOrderDetails } #endregion } - + #endregion - + } diff --git a/samples/snippets/csharp/VS_Snippets_Data/DP L2E Examples/CS/Program.cs b/samples/snippets/csharp/VS_Snippets_Data/DP L2E Examples/CS/Program.cs index fc02270be7973..e14f3e6cfb90b 100644 --- a/samples/snippets/csharp/VS_Snippets_Data/DP L2E Examples/CS/Program.cs +++ b/samples/snippets/csharp/VS_Snippets_Data/DP L2E Examples/CS/Program.cs @@ -66,7 +66,7 @@ static void Main(string[] args) /*** Grouping Operators ***/ //GroupBySimple2(); //GroupBySimple2_MQ(); - //GroupBySimple3(); + //GroupBySimple3(); //GroupBySimple3_MQ(); //GroupByCount(); // GroupByCount_MQ(); @@ -85,7 +85,7 @@ static void Main(string[] args) /*** Conversion Operators ***/ //ToArray(); //Streamlined code //ToList(); //Streamlined code - //ToDictionary(); + //ToDictionary(); /*** Element Operators ***/ //FirstSimple(); @@ -93,7 +93,7 @@ static void Main(string[] args) //ElementAt(); // ElementAt not supported by L2E. /*** Quantifier Operators ***/ - //AnyGrouped_MQ(); + //AnyGrouped_MQ(); //AllGrouped_MQ(); /*** Aggregate Operators ***/ @@ -101,17 +101,17 @@ static void Main(string[] args) //Average_MQ(); //Average2_MQ(); //Count(); - //CountNested(); + //CountNested(); //CountGrouped(); //LongCountSimple(); //SumProjection_MQ(); //SumGrouped_MQ(); //MinProjection_MQ(); //MinGrouped_MQ(); - //MinElements_MQ(); + //MinElements_MQ(); //AverageProjection_MQ(); //AverageGrouped_MQ(); - //AverageElements_MQ(); + //AverageElements_MQ(); //MaxProjection_MQ(); //MaxGrouped_MQ(); //MaxElements_MQ(); @@ -122,7 +122,7 @@ static void Main(string[] args) //JoinWithGroupedResults_MQ(); //Times out. // GroupJoin(); //GroupJoin_MQ(); - //GroupJoin2(); + //GroupJoin2(); //GroupJoin2_MQ(); /*** Relationship Navigation***/ @@ -411,7 +411,7 @@ static void CompoundFrom1_MQ() { Console.WriteLine("SalesOrderID: " + smallOrder); } - + }*/ // } @@ -424,13 +424,13 @@ static void LINQEntityTypeCollection() using (AdventureWorksEntities context = new AdventureWorksEntities()) { string LastName = "Zhou"; - var query = from contact in context.Contacts where + var query = from contact in context.Contacts where contact.LastName == LastName select contact; // Iterate through the collection of Contact items. foreach( var result in query) { - Console.WriteLine("Contact First Name: {0}; Last Name: {1}", + Console.WriteLine("Contact First Name: {0}; Last Name: {1}", result.FirstName, result.LastName); } } @@ -777,7 +777,7 @@ static void TakeWhileSimple_MQ() static void SkipWhileSimple_MQ() { - // SkipWhile not supported in L2E. + // SkipWhile not supported in L2E. /* using (AdventureWorksEntities context = new AdventureWorksEntities()) { ObjectSet products = context.Products; @@ -1057,7 +1057,7 @@ static void GroupBySimple3() var query = from address in context.Addresses group address by address.PostalCode into addressGroup - select new { PostalCode = addressGroup.Key, + select new { PostalCode = addressGroup.Key, AddressLine = addressGroup }; foreach (var addressGroup in query) @@ -1079,8 +1079,8 @@ static void GroupBySimple3_MQ() using (AdventureWorksEntities context = new AdventureWorksEntities()) { var query = context.Addresses - .GroupBy( address => address.PostalCode); - + .GroupBy( address => address.PostalCode); + foreach (IGrouping addressGroup in query) { Console.WriteLine("Postal Code: {0}", addressGroup.Key); @@ -1100,8 +1100,8 @@ static void GroupByCount() using (AdventureWorksEntities context = new AdventureWorksEntities()) { var query = from order in context.SalesOrderHeaders - group order by order.CustomerID into idGroup - select new {CustomerID = idGroup.Key, + group order by order.CustomerID into idGroup + select new {CustomerID = idGroup.Key, OrderCount = idGroup.Count(), Sales = idGroup}; @@ -1128,7 +1128,7 @@ static void GroupByCount_MQ() { var query = context.SalesOrderHeaders .GroupBy(order => order.CustomerID); - + foreach (IGrouping group in query) { Console.WriteLine("Customer ID: {0}", group.Key); @@ -1138,7 +1138,7 @@ static void GroupByCount_MQ() { Console.WriteLine(" Sale ID: {0}", sale.SalesOrderID); } - Console.WriteLine(""); + Console.WriteLine(""); } } // @@ -1290,7 +1290,7 @@ static void Union1_MQ() { // string title = "Ms."; - string firstName = "Sandra"; + string firstName = "Sandra"; using (AdventureWorksEntities context = new AdventureWorksEntities()) { IQueryable query1 = context.Contacts @@ -1316,7 +1316,7 @@ static void Intersect1() { // string title = "Ms."; - string firstName = "Sandra"; + string firstName = "Sandra"; using (AdventureWorksEntities context = new AdventureWorksEntities()) { ObjectSet contact = context.Contacts; @@ -1346,7 +1346,7 @@ static void Intersect1_MQ() { // string title = "Ms."; - string firstName = "Sandra"; + string firstName = "Sandra"; using (AdventureWorksEntities context = new AdventureWorksEntities()) { ObjectSet contact = context.Contacts; @@ -2123,7 +2123,7 @@ static void GroupJoin_MQ() ObjectSet contacts = context.Contacts; ObjectSet orders = context.SalesOrderHeaders; - var query = contacts.GroupJoin(orders, + var query = contacts.GroupJoin(orders, contact => contact.ContactID, order => order.Contact.ContactID, (contact, contactGroup) => new @@ -2184,7 +2184,7 @@ static void GroupJoin2_MQ() ObjectSet orders = context.SalesOrderHeaders; ObjectSet details = context.SalesOrderDetails; - var query = orders.GroupJoin(details, + var query = orders.GroupJoin(details, order => order.SalesOrderID, detail => detail.SalesOrderID, (order, orderGroup) => new @@ -2350,7 +2350,7 @@ static void GetOrderInfoThruRelationships() Console.WriteLine(""); } } - // + // } static void GetOrderInfoThruRelationships_MQ() @@ -2379,7 +2379,7 @@ static void GetOrderInfoThruRelationships_MQ() Console.WriteLine(""); } } - // + // } #endregion diff --git a/samples/snippets/csharp/VS_Snippets_Data/DP L2E Examples/CS/adventureworksmodel.designer.cs b/samples/snippets/csharp/VS_Snippets_Data/DP L2E Examples/CS/adventureworksmodel.designer.cs index f6ed816f902cd..ab4e819a46a2f 100644 --- a/samples/snippets/csharp/VS_Snippets_Data/DP L2E Examples/CS/adventureworksmodel.designer.cs +++ b/samples/snippets/csharp/VS_Snippets_Data/DP L2E Examples/CS/adventureworksmodel.designer.cs @@ -40,7 +40,7 @@ public AdventureWorksEntities() : base("name=AdventureWorksEntities", "Adventure { OnContextCreated(); } - + /// /// Initialize a new AdventureWorksEntities object. /// @@ -48,7 +48,7 @@ public AdventureWorksEntities(string connectionString) : base(connectionString, { OnContextCreated(); } - + /// /// Initialize a new AdventureWorksEntities object. /// @@ -57,11 +57,11 @@ public AdventureWorksEntities(EntityConnection connection) : base(connection, "A OnContextCreated(); } #endregion - + #region Partial Methods partial void OnContextCreated(); #endregion - + #region ObjectSet Properties /// /// No Metadata Documentation available. @@ -78,7 +78,7 @@ public ObjectSet
Addresses } } private ObjectSet
_Addresses; - + /// /// No Metadata Documentation available. /// @@ -94,7 +94,7 @@ public ObjectSet Contacts } } private ObjectSet _Contacts; - + /// /// No Metadata Documentation available. /// @@ -110,7 +110,7 @@ public ObjectSet Products } } private ObjectSet _Products; - + /// /// No Metadata Documentation available. /// @@ -126,7 +126,7 @@ public ObjectSet SalesOrderDetails } } private ObjectSet _SalesOrderDetails; - + /// /// No Metadata Documentation available. /// @@ -142,10 +142,10 @@ public ObjectSet SalesOrderHeaders } } private ObjectSet _SalesOrderHeaders; - + #endregion #region AddTo Methods - + /// /// Deprecated Method for adding a new object to the Addresses EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// @@ -153,7 +153,7 @@ public void AddToAddresses(Address address) { base.AddObject("Addresses", address); } - + /// /// Deprecated Method for adding a new object to the Contacts EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// @@ -161,7 +161,7 @@ public void AddToContacts(Contact contact) { base.AddObject("Contacts", contact); } - + /// /// Deprecated Method for adding a new object to the Products EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// @@ -169,7 +169,7 @@ public void AddToProducts(Product product) { base.AddObject("Products", product); } - + /// /// Deprecated Method for adding a new object to the SalesOrderDetails EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// @@ -177,7 +177,7 @@ public void AddToSalesOrderDetails(SalesOrderDetail salesOrderDetail) { base.AddObject("SalesOrderDetails", salesOrderDetail); } - + /// /// Deprecated Method for adding a new object to the SalesOrderHeaders EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// @@ -187,10 +187,10 @@ public void AddToSalesOrderHeaders(SalesOrderHeader salesOrderHeader) } #endregion } - + #endregion - - + + #region Entities /// /// No Metadata Documentation available. @@ -215,19 +215,19 @@ public static Address CreateAddress(global::System.Int32 addressID, global::Syst { Address address = new Address(); address.AddressID = addressID; - + address.AddressLine1 = addressLine1; - + address.City = city; - + address.StateProvinceID = stateProvinceID; - + address.PostalCode = postalCode; - + address.rowguid = rowguid; - + address.ModifiedDate = modifiedDate; - + return address; } #endregion @@ -255,12 +255,12 @@ public static Address CreateAddress(global::System.Int32 addressID, global::Syst OnAddressIDChanged(); } } - + } private global::System.Int32 _AddressID; partial void OnAddressIDChanging(global::System.Int32 value); partial void OnAddressIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -280,12 +280,12 @@ public static Address CreateAddress(global::System.Int32 addressID, global::Syst ReportPropertyChanged("AddressLine1"); OnAddressLine1Changed(); } - + } private global::System.String _AddressLine1; partial void OnAddressLine1Changing(global::System.String value); partial void OnAddressLine1Changed(); - + /// /// No Metadata Documentation available. /// @@ -305,12 +305,12 @@ public static Address CreateAddress(global::System.Int32 addressID, global::Syst ReportPropertyChanged("AddressLine2"); OnAddressLine2Changed(); } - + } private global::System.String _AddressLine2; partial void OnAddressLine2Changing(global::System.String value); partial void OnAddressLine2Changed(); - + /// /// No Metadata Documentation available. /// @@ -330,12 +330,12 @@ public static Address CreateAddress(global::System.Int32 addressID, global::Syst ReportPropertyChanged("City"); OnCityChanged(); } - + } private global::System.String _City; partial void OnCityChanging(global::System.String value); partial void OnCityChanged(); - + /// /// No Metadata Documentation available. /// @@ -355,12 +355,12 @@ public static Address CreateAddress(global::System.Int32 addressID, global::Syst ReportPropertyChanged("StateProvinceID"); OnStateProvinceIDChanged(); } - + } private global::System.Int32 _StateProvinceID; partial void OnStateProvinceIDChanging(global::System.Int32 value); partial void OnStateProvinceIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -380,12 +380,12 @@ public static Address CreateAddress(global::System.Int32 addressID, global::Syst ReportPropertyChanged("PostalCode"); OnPostalCodeChanged(); } - + } private global::System.String _PostalCode; partial void OnPostalCodeChanging(global::System.String value); partial void OnPostalCodeChanged(); - + /// /// No Metadata Documentation available. /// @@ -405,12 +405,12 @@ public static Address CreateAddress(global::System.Int32 addressID, global::Syst ReportPropertyChanged("rowguid"); OnrowguidChanged(); } - + } private global::System.Guid _rowguid; partial void OnrowguidChanging(global::System.Guid value); partial void OnrowguidChanged(); - + /// /// No Metadata Documentation available. /// @@ -430,14 +430,14 @@ public static Address CreateAddress(global::System.Int32 addressID, global::Syst ReportPropertyChanged("ModifiedDate"); OnModifiedDateChanged(); } - + } private global::System.DateTime _ModifiedDate; partial void OnModifiedDateChanging(global::System.DateTime value); partial void OnModifiedDateChanged(); - + #endregion - + #region Navigation Properties /// /// No Metadata Documentation available. @@ -445,7 +445,7 @@ public static Address CreateAddress(global::System.Int32 addressID, global::Syst [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Address_BillToAddressID", "SalesOrderHeader")] + [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Address_BillToAddressID", "SalesOrderHeader")] public EntityCollection SalesOrderHeaders { get @@ -466,7 +466,7 @@ public EntityCollection SalesOrderHeaders [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Address_ShipToAddressID", "SalesOrderHeader")] + [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Address_ShipToAddressID", "SalesOrderHeader")] public EntityCollection SalesOrderHeaders1 { get @@ -483,7 +483,7 @@ public EntityCollection SalesOrderHeaders1 } #endregion } - + /// /// No Metadata Documentation available. /// @@ -509,23 +509,23 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst { Contact contact = new Contact(); contact.ContactID = contactID; - + contact.NameStyle = nameStyle; - + contact.FirstName = firstName; - + contact.LastName = lastName; - + contact.EmailPromotion = emailPromotion; - + contact.PasswordHash = passwordHash; - + contact.PasswordSalt = passwordSalt; - + contact.rowguid = rowguid; - + contact.ModifiedDate = modifiedDate; - + return contact; } #endregion @@ -553,12 +553,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst OnContactIDChanged(); } } - + } private global::System.Int32 _ContactID; partial void OnContactIDChanging(global::System.Int32 value); partial void OnContactIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -578,12 +578,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("NameStyle"); OnNameStyleChanged(); } - + } private global::System.Boolean _NameStyle; partial void OnNameStyleChanging(global::System.Boolean value); partial void OnNameStyleChanged(); - + /// /// No Metadata Documentation available. /// @@ -603,12 +603,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("Title"); OnTitleChanged(); } - + } private global::System.String _Title; partial void OnTitleChanging(global::System.String value); partial void OnTitleChanged(); - + /// /// No Metadata Documentation available. /// @@ -628,12 +628,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("FirstName"); OnFirstNameChanged(); } - + } private global::System.String _FirstName; partial void OnFirstNameChanging(global::System.String value); partial void OnFirstNameChanged(); - + /// /// No Metadata Documentation available. /// @@ -653,12 +653,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("MiddleName"); OnMiddleNameChanged(); } - + } private global::System.String _MiddleName; partial void OnMiddleNameChanging(global::System.String value); partial void OnMiddleNameChanged(); - + /// /// No Metadata Documentation available. /// @@ -678,12 +678,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("LastName"); OnLastNameChanged(); } - + } private global::System.String _LastName; partial void OnLastNameChanging(global::System.String value); partial void OnLastNameChanged(); - + /// /// No Metadata Documentation available. /// @@ -703,12 +703,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("Suffix"); OnSuffixChanged(); } - + } private global::System.String _Suffix; partial void OnSuffixChanging(global::System.String value); partial void OnSuffixChanged(); - + /// /// No Metadata Documentation available. /// @@ -728,12 +728,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("EmailAddress"); OnEmailAddressChanged(); } - + } private global::System.String _EmailAddress; partial void OnEmailAddressChanging(global::System.String value); partial void OnEmailAddressChanged(); - + /// /// No Metadata Documentation available. /// @@ -753,12 +753,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("EmailPromotion"); OnEmailPromotionChanged(); } - + } private global::System.Int32 _EmailPromotion; partial void OnEmailPromotionChanging(global::System.Int32 value); partial void OnEmailPromotionChanged(); - + /// /// No Metadata Documentation available. /// @@ -778,12 +778,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("Phone"); OnPhoneChanged(); } - + } private global::System.String _Phone; partial void OnPhoneChanging(global::System.String value); partial void OnPhoneChanged(); - + /// /// No Metadata Documentation available. /// @@ -803,12 +803,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("PasswordHash"); OnPasswordHashChanged(); } - + } private global::System.String _PasswordHash; partial void OnPasswordHashChanging(global::System.String value); partial void OnPasswordHashChanged(); - + /// /// No Metadata Documentation available. /// @@ -828,12 +828,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("PasswordSalt"); OnPasswordSaltChanged(); } - + } private global::System.String _PasswordSalt; partial void OnPasswordSaltChanging(global::System.String value); partial void OnPasswordSaltChanged(); - + /// /// No Metadata Documentation available. /// @@ -853,12 +853,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("AdditionalContactInfo"); OnAdditionalContactInfoChanged(); } - + } private global::System.String _AdditionalContactInfo; partial void OnAdditionalContactInfoChanging(global::System.String value); partial void OnAdditionalContactInfoChanged(); - + /// /// No Metadata Documentation available. /// @@ -878,12 +878,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("rowguid"); OnrowguidChanged(); } - + } private global::System.Guid _rowguid; partial void OnrowguidChanging(global::System.Guid value); partial void OnrowguidChanged(); - + /// /// No Metadata Documentation available. /// @@ -903,14 +903,14 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("ModifiedDate"); OnModifiedDateChanged(); } - + } private global::System.DateTime _ModifiedDate; partial void OnModifiedDateChanging(global::System.DateTime value); partial void OnModifiedDateChanged(); - + #endregion - + #region Navigation Properties /// /// No Metadata Documentation available. @@ -918,7 +918,7 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Contact_ContactID", "SalesOrderHeader")] + [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Contact_ContactID", "SalesOrderHeader")] public EntityCollection SalesOrderHeaders { get @@ -935,7 +935,7 @@ public EntityCollection SalesOrderHeaders } #endregion } - + /// /// No Metadata Documentation available. /// @@ -965,31 +965,31 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst { Product product = new Product(); product.ProductID = productID; - + product.Name = name; - + product.ProductNumber = productNumber; - + product.MakeFlag = makeFlag; - + product.FinishedGoodsFlag = finishedGoodsFlag; - + product.SafetyStockLevel = safetyStockLevel; - + product.ReorderPoint = reorderPoint; - + product.StandardCost = standardCost; - + product.ListPrice = listPrice; - + product.DaysToManufacture = daysToManufacture; - + product.SellStartDate = sellStartDate; - + product.rowguid = rowguid; - + product.ModifiedDate = modifiedDate; - + return product; } #endregion @@ -1017,12 +1017,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst OnProductIDChanged(); } } - + } private global::System.Int32 _ProductID; partial void OnProductIDChanging(global::System.Int32 value); partial void OnProductIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1042,12 +1042,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("Name"); OnNameChanged(); } - + } private global::System.String _Name; partial void OnNameChanging(global::System.String value); partial void OnNameChanged(); - + /// /// No Metadata Documentation available. /// @@ -1067,12 +1067,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("ProductNumber"); OnProductNumberChanged(); } - + } private global::System.String _ProductNumber; partial void OnProductNumberChanging(global::System.String value); partial void OnProductNumberChanged(); - + /// /// No Metadata Documentation available. /// @@ -1092,12 +1092,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("MakeFlag"); OnMakeFlagChanged(); } - + } private global::System.Boolean _MakeFlag; partial void OnMakeFlagChanging(global::System.Boolean value); partial void OnMakeFlagChanged(); - + /// /// No Metadata Documentation available. /// @@ -1117,12 +1117,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("FinishedGoodsFlag"); OnFinishedGoodsFlagChanged(); } - + } private global::System.Boolean _FinishedGoodsFlag; partial void OnFinishedGoodsFlagChanging(global::System.Boolean value); partial void OnFinishedGoodsFlagChanged(); - + /// /// No Metadata Documentation available. /// @@ -1142,12 +1142,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("Color"); OnColorChanged(); } - + } private global::System.String _Color; partial void OnColorChanging(global::System.String value); partial void OnColorChanged(); - + /// /// No Metadata Documentation available. /// @@ -1167,12 +1167,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("SafetyStockLevel"); OnSafetyStockLevelChanged(); } - + } private global::System.Int16 _SafetyStockLevel; partial void OnSafetyStockLevelChanging(global::System.Int16 value); partial void OnSafetyStockLevelChanged(); - + /// /// No Metadata Documentation available. /// @@ -1192,12 +1192,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("ReorderPoint"); OnReorderPointChanged(); } - + } private global::System.Int16 _ReorderPoint; partial void OnReorderPointChanging(global::System.Int16 value); partial void OnReorderPointChanged(); - + /// /// No Metadata Documentation available. /// @@ -1217,12 +1217,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("StandardCost"); OnStandardCostChanged(); } - + } private global::System.Decimal _StandardCost; partial void OnStandardCostChanging(global::System.Decimal value); partial void OnStandardCostChanged(); - + /// /// No Metadata Documentation available. /// @@ -1242,12 +1242,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("ListPrice"); OnListPriceChanged(); } - + } private global::System.Decimal _ListPrice; partial void OnListPriceChanging(global::System.Decimal value); partial void OnListPriceChanged(); - + /// /// No Metadata Documentation available. /// @@ -1267,12 +1267,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("Size"); OnSizeChanged(); } - + } private global::System.String _Size; partial void OnSizeChanging(global::System.String value); partial void OnSizeChanged(); - + /// /// No Metadata Documentation available. /// @@ -1292,12 +1292,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("SizeUnitMeasureCode"); OnSizeUnitMeasureCodeChanged(); } - + } private global::System.String _SizeUnitMeasureCode; partial void OnSizeUnitMeasureCodeChanging(global::System.String value); partial void OnSizeUnitMeasureCodeChanged(); - + /// /// No Metadata Documentation available. /// @@ -1317,12 +1317,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("WeightUnitMeasureCode"); OnWeightUnitMeasureCodeChanged(); } - + } private global::System.String _WeightUnitMeasureCode; partial void OnWeightUnitMeasureCodeChanging(global::System.String value); partial void OnWeightUnitMeasureCodeChanged(); - + /// /// No Metadata Documentation available. /// @@ -1342,12 +1342,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("Weight"); OnWeightChanged(); } - + } private Nullable _Weight; partial void OnWeightChanging(Nullable value); partial void OnWeightChanged(); - + /// /// No Metadata Documentation available. /// @@ -1367,12 +1367,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("DaysToManufacture"); OnDaysToManufactureChanged(); } - + } private global::System.Int32 _DaysToManufacture; partial void OnDaysToManufactureChanging(global::System.Int32 value); partial void OnDaysToManufactureChanged(); - + /// /// No Metadata Documentation available. /// @@ -1392,12 +1392,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("ProductLine"); OnProductLineChanged(); } - + } private global::System.String _ProductLine; partial void OnProductLineChanging(global::System.String value); partial void OnProductLineChanged(); - + /// /// No Metadata Documentation available. /// @@ -1417,12 +1417,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("Class"); OnClassChanged(); } - + } private global::System.String _Class; partial void OnClassChanging(global::System.String value); partial void OnClassChanged(); - + /// /// No Metadata Documentation available. /// @@ -1442,12 +1442,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("Style"); OnStyleChanged(); } - + } private global::System.String _Style; partial void OnStyleChanging(global::System.String value); partial void OnStyleChanged(); - + /// /// No Metadata Documentation available. /// @@ -1467,12 +1467,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("ProductSubcategoryID"); OnProductSubcategoryIDChanged(); } - + } private Nullable _ProductSubcategoryID; partial void OnProductSubcategoryIDChanging(Nullable value); partial void OnProductSubcategoryIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1492,12 +1492,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("ProductModelID"); OnProductModelIDChanged(); } - + } private Nullable _ProductModelID; partial void OnProductModelIDChanging(Nullable value); partial void OnProductModelIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1517,12 +1517,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("SellStartDate"); OnSellStartDateChanged(); } - + } private global::System.DateTime _SellStartDate; partial void OnSellStartDateChanging(global::System.DateTime value); partial void OnSellStartDateChanged(); - + /// /// No Metadata Documentation available. /// @@ -1542,12 +1542,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("SellEndDate"); OnSellEndDateChanged(); } - + } private Nullable _SellEndDate; partial void OnSellEndDateChanging(Nullable value); partial void OnSellEndDateChanged(); - + /// /// No Metadata Documentation available. /// @@ -1567,12 +1567,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("DiscontinuedDate"); OnDiscontinuedDateChanged(); } - + } private Nullable _DiscontinuedDate; partial void OnDiscontinuedDateChanging(Nullable value); partial void OnDiscontinuedDateChanged(); - + /// /// No Metadata Documentation available. /// @@ -1592,12 +1592,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("rowguid"); OnrowguidChanged(); } - + } private global::System.Guid _rowguid; partial void OnrowguidChanging(global::System.Guid value); partial void OnrowguidChanged(); - + /// /// No Metadata Documentation available. /// @@ -1617,16 +1617,16 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("ModifiedDate"); OnModifiedDateChanged(); } - + } private global::System.DateTime _ModifiedDate; partial void OnModifiedDateChanging(global::System.DateTime value); partial void OnModifiedDateChanged(); - + #endregion - + } - + /// /// No Metadata Documentation available. /// @@ -1653,25 +1653,25 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales { SalesOrderDetail salesOrderDetail = new SalesOrderDetail(); salesOrderDetail.SalesOrderID = salesOrderID; - + salesOrderDetail.SalesOrderDetailID = salesOrderDetailID; - + salesOrderDetail.OrderQty = orderQty; - + salesOrderDetail.ProductID = productID; - + salesOrderDetail.SpecialOfferID = specialOfferID; - + salesOrderDetail.UnitPrice = unitPrice; - + salesOrderDetail.UnitPriceDiscount = unitPriceDiscount; - + salesOrderDetail.LineTotal = lineTotal; - + salesOrderDetail.rowguid = rowguid; - + salesOrderDetail.ModifiedDate = modifiedDate; - + return salesOrderDetail; } #endregion @@ -1699,12 +1699,12 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales OnSalesOrderIDChanged(); } } - + } private global::System.Int32 _SalesOrderID; partial void OnSalesOrderIDChanging(global::System.Int32 value); partial void OnSalesOrderIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1727,12 +1727,12 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales OnSalesOrderDetailIDChanged(); } } - + } private global::System.Int32 _SalesOrderDetailID; partial void OnSalesOrderDetailIDChanging(global::System.Int32 value); partial void OnSalesOrderDetailIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1752,12 +1752,12 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales ReportPropertyChanged("CarrierTrackingNumber"); OnCarrierTrackingNumberChanged(); } - + } private global::System.String _CarrierTrackingNumber; partial void OnCarrierTrackingNumberChanging(global::System.String value); partial void OnCarrierTrackingNumberChanged(); - + /// /// No Metadata Documentation available. /// @@ -1777,12 +1777,12 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales ReportPropertyChanged("OrderQty"); OnOrderQtyChanged(); } - + } private global::System.Int16 _OrderQty; partial void OnOrderQtyChanging(global::System.Int16 value); partial void OnOrderQtyChanged(); - + /// /// No Metadata Documentation available. /// @@ -1802,12 +1802,12 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales ReportPropertyChanged("ProductID"); OnProductIDChanged(); } - + } private global::System.Int32 _ProductID; partial void OnProductIDChanging(global::System.Int32 value); partial void OnProductIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1827,12 +1827,12 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales ReportPropertyChanged("SpecialOfferID"); OnSpecialOfferIDChanged(); } - + } private global::System.Int32 _SpecialOfferID; partial void OnSpecialOfferIDChanging(global::System.Int32 value); partial void OnSpecialOfferIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1852,12 +1852,12 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales ReportPropertyChanged("UnitPrice"); OnUnitPriceChanged(); } - + } private global::System.Decimal _UnitPrice; partial void OnUnitPriceChanging(global::System.Decimal value); partial void OnUnitPriceChanged(); - + /// /// No Metadata Documentation available. /// @@ -1877,12 +1877,12 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales ReportPropertyChanged("UnitPriceDiscount"); OnUnitPriceDiscountChanged(); } - + } private global::System.Decimal _UnitPriceDiscount; partial void OnUnitPriceDiscountChanging(global::System.Decimal value); partial void OnUnitPriceDiscountChanged(); - + /// /// No Metadata Documentation available. /// @@ -1902,12 +1902,12 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales ReportPropertyChanged("LineTotal"); OnLineTotalChanged(); } - + } private global::System.Decimal _LineTotal; partial void OnLineTotalChanging(global::System.Decimal value); partial void OnLineTotalChanged(); - + /// /// No Metadata Documentation available. /// @@ -1927,12 +1927,12 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales ReportPropertyChanged("rowguid"); OnrowguidChanged(); } - + } private global::System.Guid _rowguid; partial void OnrowguidChanging(global::System.Guid value); partial void OnrowguidChanged(); - + /// /// No Metadata Documentation available. /// @@ -1952,14 +1952,14 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales ReportPropertyChanged("ModifiedDate"); OnModifiedDateChanged(); } - + } private global::System.DateTime _ModifiedDate; partial void OnModifiedDateChanging(global::System.DateTime value); partial void OnModifiedDateChanged(); - + #endregion - + #region Navigation Properties /// /// No Metadata Documentation available. @@ -1967,7 +1967,7 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderDetail_SalesOrderHeader_SalesOrderID", "SalesOrderHeader")] + [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderDetail_SalesOrderHeader_SalesOrderID", "SalesOrderHeader")] public SalesOrderHeader SalesOrderHeader { get @@ -2000,7 +2000,7 @@ public EntityReference SalesOrderHeaderReference } #endregion } - + /// /// No Metadata Documentation available. /// @@ -2035,41 +2035,41 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales { SalesOrderHeader salesOrderHeader = new SalesOrderHeader(); salesOrderHeader.SalesOrderID = salesOrderID; - + salesOrderHeader.RevisionNumber = revisionNumber; - + salesOrderHeader.OrderDate = orderDate; - + salesOrderHeader.DueDate = dueDate; - + salesOrderHeader.Status = status; - + salesOrderHeader.OnlineOrderFlag = onlineOrderFlag; - + salesOrderHeader.SalesOrderNumber = salesOrderNumber; - + salesOrderHeader.CustomerID = customerID; - + salesOrderHeader.ContactID = contactID; - + salesOrderHeader.BillToAddressID = billToAddressID; - + salesOrderHeader.ShipToAddressID = shipToAddressID; - + salesOrderHeader.ShipMethodID = shipMethodID; - + salesOrderHeader.SubTotal = subTotal; - + salesOrderHeader.TaxAmt = taxAmt; - + salesOrderHeader.Freight = freight; - + salesOrderHeader.TotalDue = totalDue; - + salesOrderHeader.rowguid = rowguid; - + salesOrderHeader.ModifiedDate = modifiedDate; - + return salesOrderHeader; } #endregion @@ -2097,12 +2097,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales OnSalesOrderIDChanged(); } } - + } private global::System.Int32 _SalesOrderID; partial void OnSalesOrderIDChanging(global::System.Int32 value); partial void OnSalesOrderIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2122,12 +2122,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("RevisionNumber"); OnRevisionNumberChanged(); } - + } private global::System.Byte _RevisionNumber; partial void OnRevisionNumberChanging(global::System.Byte value); partial void OnRevisionNumberChanged(); - + /// /// No Metadata Documentation available. /// @@ -2147,12 +2147,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("OrderDate"); OnOrderDateChanged(); } - + } private global::System.DateTime _OrderDate; partial void OnOrderDateChanging(global::System.DateTime value); partial void OnOrderDateChanged(); - + /// /// No Metadata Documentation available. /// @@ -2172,12 +2172,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("DueDate"); OnDueDateChanged(); } - + } private global::System.DateTime _DueDate; partial void OnDueDateChanging(global::System.DateTime value); partial void OnDueDateChanged(); - + /// /// No Metadata Documentation available. /// @@ -2197,12 +2197,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("ShipDate"); OnShipDateChanged(); } - + } private Nullable _ShipDate; partial void OnShipDateChanging(Nullable value); partial void OnShipDateChanged(); - + /// /// No Metadata Documentation available. /// @@ -2222,12 +2222,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("Status"); OnStatusChanged(); } - + } private global::System.Byte _Status; partial void OnStatusChanging(global::System.Byte value); partial void OnStatusChanged(); - + /// /// No Metadata Documentation available. /// @@ -2247,12 +2247,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("OnlineOrderFlag"); OnOnlineOrderFlagChanged(); } - + } private global::System.Boolean _OnlineOrderFlag; partial void OnOnlineOrderFlagChanging(global::System.Boolean value); partial void OnOnlineOrderFlagChanged(); - + /// /// No Metadata Documentation available. /// @@ -2272,12 +2272,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("SalesOrderNumber"); OnSalesOrderNumberChanged(); } - + } private global::System.String _SalesOrderNumber; partial void OnSalesOrderNumberChanging(global::System.String value); partial void OnSalesOrderNumberChanged(); - + /// /// No Metadata Documentation available. /// @@ -2297,12 +2297,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("PurchaseOrderNumber"); OnPurchaseOrderNumberChanged(); } - + } private global::System.String _PurchaseOrderNumber; partial void OnPurchaseOrderNumberChanging(global::System.String value); partial void OnPurchaseOrderNumberChanged(); - + /// /// No Metadata Documentation available. /// @@ -2322,12 +2322,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("AccountNumber"); OnAccountNumberChanged(); } - + } private global::System.String _AccountNumber; partial void OnAccountNumberChanging(global::System.String value); partial void OnAccountNumberChanged(); - + /// /// No Metadata Documentation available. /// @@ -2347,12 +2347,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("CustomerID"); OnCustomerIDChanged(); } - + } private global::System.Int32 _CustomerID; partial void OnCustomerIDChanging(global::System.Int32 value); partial void OnCustomerIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2372,12 +2372,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("ContactID"); OnContactIDChanged(); } - + } private global::System.Int32 _ContactID; partial void OnContactIDChanging(global::System.Int32 value); partial void OnContactIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2397,12 +2397,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("SalesPersonID"); OnSalesPersonIDChanged(); } - + } private Nullable _SalesPersonID; partial void OnSalesPersonIDChanging(Nullable value); partial void OnSalesPersonIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2422,12 +2422,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("TerritoryID"); OnTerritoryIDChanged(); } - + } private Nullable _TerritoryID; partial void OnTerritoryIDChanging(Nullable value); partial void OnTerritoryIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2447,12 +2447,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("BillToAddressID"); OnBillToAddressIDChanged(); } - + } private global::System.Int32 _BillToAddressID; partial void OnBillToAddressIDChanging(global::System.Int32 value); partial void OnBillToAddressIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2472,12 +2472,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("ShipToAddressID"); OnShipToAddressIDChanged(); } - + } private global::System.Int32 _ShipToAddressID; partial void OnShipToAddressIDChanging(global::System.Int32 value); partial void OnShipToAddressIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2497,12 +2497,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("ShipMethodID"); OnShipMethodIDChanged(); } - + } private global::System.Int32 _ShipMethodID; partial void OnShipMethodIDChanging(global::System.Int32 value); partial void OnShipMethodIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2522,12 +2522,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("CreditCardID"); OnCreditCardIDChanged(); } - + } private Nullable _CreditCardID; partial void OnCreditCardIDChanging(Nullable value); partial void OnCreditCardIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2547,12 +2547,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("CreditCardApprovalCode"); OnCreditCardApprovalCodeChanged(); } - + } private global::System.String _CreditCardApprovalCode; partial void OnCreditCardApprovalCodeChanging(global::System.String value); partial void OnCreditCardApprovalCodeChanged(); - + /// /// No Metadata Documentation available. /// @@ -2572,12 +2572,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("CurrencyRateID"); OnCurrencyRateIDChanged(); } - + } private Nullable _CurrencyRateID; partial void OnCurrencyRateIDChanging(Nullable value); partial void OnCurrencyRateIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2597,12 +2597,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("SubTotal"); OnSubTotalChanged(); } - + } private global::System.Decimal _SubTotal; partial void OnSubTotalChanging(global::System.Decimal value); partial void OnSubTotalChanged(); - + /// /// No Metadata Documentation available. /// @@ -2622,12 +2622,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("TaxAmt"); OnTaxAmtChanged(); } - + } private global::System.Decimal _TaxAmt; partial void OnTaxAmtChanging(global::System.Decimal value); partial void OnTaxAmtChanged(); - + /// /// No Metadata Documentation available. /// @@ -2647,12 +2647,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("Freight"); OnFreightChanged(); } - + } private global::System.Decimal _Freight; partial void OnFreightChanging(global::System.Decimal value); partial void OnFreightChanged(); - + /// /// No Metadata Documentation available. /// @@ -2672,12 +2672,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("TotalDue"); OnTotalDueChanged(); } - + } private global::System.Decimal _TotalDue; partial void OnTotalDueChanging(global::System.Decimal value); partial void OnTotalDueChanged(); - + /// /// No Metadata Documentation available. /// @@ -2697,12 +2697,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("Comment"); OnCommentChanged(); } - + } private global::System.String _Comment; partial void OnCommentChanging(global::System.String value); partial void OnCommentChanged(); - + /// /// No Metadata Documentation available. /// @@ -2722,12 +2722,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("rowguid"); OnrowguidChanged(); } - + } private global::System.Guid _rowguid; partial void OnrowguidChanging(global::System.Guid value); partial void OnrowguidChanged(); - + /// /// No Metadata Documentation available. /// @@ -2747,14 +2747,14 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("ModifiedDate"); OnModifiedDateChanged(); } - + } private global::System.DateTime _ModifiedDate; partial void OnModifiedDateChanging(global::System.DateTime value); partial void OnModifiedDateChanged(); - + #endregion - + #region Navigation Properties /// /// No Metadata Documentation available. @@ -2762,7 +2762,7 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Address_BillToAddressID", "Address")] + [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Address_BillToAddressID", "Address")] public Address Address { get @@ -2799,7 +2799,7 @@ public EntityReference
AddressReference [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Address_ShipToAddressID", "Address")] + [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Address_ShipToAddressID", "Address")] public Address Address1 { get @@ -2836,7 +2836,7 @@ public EntityReference
Address1Reference [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Contact_ContactID", "Contact")] + [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Contact_ContactID", "Contact")] public Contact Contact { get @@ -2873,7 +2873,7 @@ public EntityReference ContactReference [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderDetail_SalesOrderHeader_SalesOrderID", "SalesOrderDetail")] + [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderDetail_SalesOrderHeader_SalesOrderID", "SalesOrderDetail")] public EntityCollection SalesOrderDetails { get @@ -2890,7 +2890,7 @@ public EntityCollection SalesOrderDetails } #endregion } - + #endregion - + } diff --git a/samples/snippets/csharp/VS_Snippets_Data/DP L2E Materialization Example/CS/AdventureWorksModel.Designer.cs b/samples/snippets/csharp/VS_Snippets_Data/DP L2E Materialization Example/CS/AdventureWorksModel.Designer.cs index c0ce4adbdf5e7..98c080b9e9d52 100644 --- a/samples/snippets/csharp/VS_Snippets_Data/DP L2E Materialization Example/CS/AdventureWorksModel.Designer.cs +++ b/samples/snippets/csharp/VS_Snippets_Data/DP L2E Materialization Example/CS/AdventureWorksModel.Designer.cs @@ -40,7 +40,7 @@ public AdventureWorksEntities() : base("name=AdventureWorksEntities", "Adventure { OnContextCreated(); } - + /// /// Initialize a new AdventureWorksEntities object. /// @@ -48,7 +48,7 @@ public AdventureWorksEntities(string connectionString) : base(connectionString, { OnContextCreated(); } - + /// /// Initialize a new AdventureWorksEntities object. /// @@ -57,11 +57,11 @@ public AdventureWorksEntities(EntityConnection connection) : base(connection, "A OnContextCreated(); } #endregion - + #region Partial Methods partial void OnContextCreated(); #endregion - + #region ObjectSet Properties /// /// No Metadata Documentation available. @@ -78,7 +78,7 @@ public ObjectSet
Addresses } } private ObjectSet
_Addresses; - + /// /// No Metadata Documentation available. /// @@ -94,7 +94,7 @@ public ObjectSet Contacts } } private ObjectSet _Contacts; - + /// /// No Metadata Documentation available. /// @@ -110,7 +110,7 @@ public ObjectSet Products } } private ObjectSet _Products; - + /// /// No Metadata Documentation available. /// @@ -126,7 +126,7 @@ public ObjectSet SalesOrderDetails } } private ObjectSet _SalesOrderDetails; - + /// /// No Metadata Documentation available. /// @@ -142,10 +142,10 @@ public ObjectSet SalesOrderHeaders } } private ObjectSet _SalesOrderHeaders; - + #endregion #region AddTo Methods - + /// /// Deprecated Method for adding a new object to the Addresses EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// @@ -153,7 +153,7 @@ public void AddToAddresses(Address address) { base.AddObject("Addresses", address); } - + /// /// Deprecated Method for adding a new object to the Contacts EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// @@ -161,7 +161,7 @@ public void AddToContacts(Contact contact) { base.AddObject("Contacts", contact); } - + /// /// Deprecated Method for adding a new object to the Products EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// @@ -169,7 +169,7 @@ public void AddToProducts(Product product) { base.AddObject("Products", product); } - + /// /// Deprecated Method for adding a new object to the SalesOrderDetails EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// @@ -177,7 +177,7 @@ public void AddToSalesOrderDetails(SalesOrderDetail salesOrderDetail) { base.AddObject("SalesOrderDetails", salesOrderDetail); } - + /// /// Deprecated Method for adding a new object to the SalesOrderHeaders EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// @@ -187,10 +187,10 @@ public void AddToSalesOrderHeaders(SalesOrderHeader salesOrderHeader) } #endregion } - + #endregion - - + + #region Entities /// /// No Metadata Documentation available. @@ -215,19 +215,19 @@ public static Address CreateAddress(global::System.Int32 addressID, global::Syst { Address address = new Address(); address.AddressID = addressID; - + address.AddressLine1 = addressLine1; - + address.City = city; - + address.StateProvinceID = stateProvinceID; - + address.PostalCode = postalCode; - + address.rowguid = rowguid; - + address.ModifiedDate = modifiedDate; - + return address; } #endregion @@ -255,12 +255,12 @@ public static Address CreateAddress(global::System.Int32 addressID, global::Syst OnAddressIDChanged(); } } - + } private global::System.Int32 _AddressID; partial void OnAddressIDChanging(global::System.Int32 value); partial void OnAddressIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -280,12 +280,12 @@ public static Address CreateAddress(global::System.Int32 addressID, global::Syst ReportPropertyChanged("AddressLine1"); OnAddressLine1Changed(); } - + } private global::System.String _AddressLine1; partial void OnAddressLine1Changing(global::System.String value); partial void OnAddressLine1Changed(); - + /// /// No Metadata Documentation available. /// @@ -305,12 +305,12 @@ public static Address CreateAddress(global::System.Int32 addressID, global::Syst ReportPropertyChanged("AddressLine2"); OnAddressLine2Changed(); } - + } private global::System.String _AddressLine2; partial void OnAddressLine2Changing(global::System.String value); partial void OnAddressLine2Changed(); - + /// /// No Metadata Documentation available. /// @@ -330,12 +330,12 @@ public static Address CreateAddress(global::System.Int32 addressID, global::Syst ReportPropertyChanged("City"); OnCityChanged(); } - + } private global::System.String _City; partial void OnCityChanging(global::System.String value); partial void OnCityChanged(); - + /// /// No Metadata Documentation available. /// @@ -355,12 +355,12 @@ public static Address CreateAddress(global::System.Int32 addressID, global::Syst ReportPropertyChanged("StateProvinceID"); OnStateProvinceIDChanged(); } - + } private global::System.Int32 _StateProvinceID; partial void OnStateProvinceIDChanging(global::System.Int32 value); partial void OnStateProvinceIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -380,12 +380,12 @@ public static Address CreateAddress(global::System.Int32 addressID, global::Syst ReportPropertyChanged("PostalCode"); OnPostalCodeChanged(); } - + } private global::System.String _PostalCode; partial void OnPostalCodeChanging(global::System.String value); partial void OnPostalCodeChanged(); - + /// /// No Metadata Documentation available. /// @@ -405,12 +405,12 @@ public static Address CreateAddress(global::System.Int32 addressID, global::Syst ReportPropertyChanged("rowguid"); OnrowguidChanged(); } - + } private global::System.Guid _rowguid; partial void OnrowguidChanging(global::System.Guid value); partial void OnrowguidChanged(); - + /// /// No Metadata Documentation available. /// @@ -430,14 +430,14 @@ public static Address CreateAddress(global::System.Int32 addressID, global::Syst ReportPropertyChanged("ModifiedDate"); OnModifiedDateChanged(); } - + } private global::System.DateTime _ModifiedDate; partial void OnModifiedDateChanging(global::System.DateTime value); partial void OnModifiedDateChanged(); - + #endregion - + #region Navigation Properties /// /// No Metadata Documentation available. @@ -445,7 +445,7 @@ public static Address CreateAddress(global::System.Int32 addressID, global::Syst [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Address_BillToAddressID", "SalesOrderHeader")] + [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Address_BillToAddressID", "SalesOrderHeader")] public EntityCollection SalesOrderHeaders { get @@ -466,7 +466,7 @@ public EntityCollection SalesOrderHeaders [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Address_ShipToAddressID", "SalesOrderHeader")] + [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Address_ShipToAddressID", "SalesOrderHeader")] public EntityCollection SalesOrderHeaders1 { get @@ -483,7 +483,7 @@ public EntityCollection SalesOrderHeaders1 } #endregion } - + /// /// No Metadata Documentation available. /// @@ -509,23 +509,23 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst { Contact contact = new Contact(); contact.ContactID = contactID; - + contact.NameStyle = nameStyle; - + contact.FirstName = firstName; - + contact.LastName = lastName; - + contact.EmailPromotion = emailPromotion; - + contact.PasswordHash = passwordHash; - + contact.PasswordSalt = passwordSalt; - + contact.rowguid = rowguid; - + contact.ModifiedDate = modifiedDate; - + return contact; } #endregion @@ -553,12 +553,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst OnContactIDChanged(); } } - + } private global::System.Int32 _ContactID; partial void OnContactIDChanging(global::System.Int32 value); partial void OnContactIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -578,12 +578,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("NameStyle"); OnNameStyleChanged(); } - + } private global::System.Boolean _NameStyle; partial void OnNameStyleChanging(global::System.Boolean value); partial void OnNameStyleChanged(); - + /// /// No Metadata Documentation available. /// @@ -603,12 +603,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("Title"); OnTitleChanged(); } - + } private global::System.String _Title; partial void OnTitleChanging(global::System.String value); partial void OnTitleChanged(); - + /// /// No Metadata Documentation available. /// @@ -628,12 +628,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("FirstName"); OnFirstNameChanged(); } - + } private global::System.String _FirstName; partial void OnFirstNameChanging(global::System.String value); partial void OnFirstNameChanged(); - + /// /// No Metadata Documentation available. /// @@ -653,12 +653,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("MiddleName"); OnMiddleNameChanged(); } - + } private global::System.String _MiddleName; partial void OnMiddleNameChanging(global::System.String value); partial void OnMiddleNameChanged(); - + /// /// No Metadata Documentation available. /// @@ -678,12 +678,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("LastName"); OnLastNameChanged(); } - + } private global::System.String _LastName; partial void OnLastNameChanging(global::System.String value); partial void OnLastNameChanged(); - + /// /// No Metadata Documentation available. /// @@ -703,12 +703,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("Suffix"); OnSuffixChanged(); } - + } private global::System.String _Suffix; partial void OnSuffixChanging(global::System.String value); partial void OnSuffixChanged(); - + /// /// No Metadata Documentation available. /// @@ -728,12 +728,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("EmailAddress"); OnEmailAddressChanged(); } - + } private global::System.String _EmailAddress; partial void OnEmailAddressChanging(global::System.String value); partial void OnEmailAddressChanged(); - + /// /// No Metadata Documentation available. /// @@ -753,12 +753,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("EmailPromotion"); OnEmailPromotionChanged(); } - + } private global::System.Int32 _EmailPromotion; partial void OnEmailPromotionChanging(global::System.Int32 value); partial void OnEmailPromotionChanged(); - + /// /// No Metadata Documentation available. /// @@ -778,12 +778,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("Phone"); OnPhoneChanged(); } - + } private global::System.String _Phone; partial void OnPhoneChanging(global::System.String value); partial void OnPhoneChanged(); - + /// /// No Metadata Documentation available. /// @@ -803,12 +803,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("PasswordHash"); OnPasswordHashChanged(); } - + } private global::System.String _PasswordHash; partial void OnPasswordHashChanging(global::System.String value); partial void OnPasswordHashChanged(); - + /// /// No Metadata Documentation available. /// @@ -828,12 +828,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("PasswordSalt"); OnPasswordSaltChanged(); } - + } private global::System.String _PasswordSalt; partial void OnPasswordSaltChanging(global::System.String value); partial void OnPasswordSaltChanged(); - + /// /// No Metadata Documentation available. /// @@ -853,12 +853,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("AdditionalContactInfo"); OnAdditionalContactInfoChanged(); } - + } private global::System.String _AdditionalContactInfo; partial void OnAdditionalContactInfoChanging(global::System.String value); partial void OnAdditionalContactInfoChanged(); - + /// /// No Metadata Documentation available. /// @@ -878,12 +878,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("rowguid"); OnrowguidChanged(); } - + } private global::System.Guid _rowguid; partial void OnrowguidChanging(global::System.Guid value); partial void OnrowguidChanged(); - + /// /// No Metadata Documentation available. /// @@ -903,14 +903,14 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("ModifiedDate"); OnModifiedDateChanged(); } - + } private global::System.DateTime _ModifiedDate; partial void OnModifiedDateChanging(global::System.DateTime value); partial void OnModifiedDateChanged(); - + #endregion - + #region Navigation Properties /// /// No Metadata Documentation available. @@ -918,7 +918,7 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Contact_ContactID", "SalesOrderHeader")] + [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Contact_ContactID", "SalesOrderHeader")] public EntityCollection SalesOrderHeaders { get @@ -935,7 +935,7 @@ public EntityCollection SalesOrderHeaders } #endregion } - + /// /// No Metadata Documentation available. /// @@ -965,31 +965,31 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst { Product product = new Product(); product.ProductID = productID; - + product.Name = name; - + product.ProductNumber = productNumber; - + product.MakeFlag = makeFlag; - + product.FinishedGoodsFlag = finishedGoodsFlag; - + product.SafetyStockLevel = safetyStockLevel; - + product.ReorderPoint = reorderPoint; - + product.StandardCost = standardCost; - + product.ListPrice = listPrice; - + product.DaysToManufacture = daysToManufacture; - + product.SellStartDate = sellStartDate; - + product.rowguid = rowguid; - + product.ModifiedDate = modifiedDate; - + return product; } #endregion @@ -1017,12 +1017,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst OnProductIDChanged(); } } - + } private global::System.Int32 _ProductID; partial void OnProductIDChanging(global::System.Int32 value); partial void OnProductIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1042,12 +1042,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("Name"); OnNameChanged(); } - + } private global::System.String _Name; partial void OnNameChanging(global::System.String value); partial void OnNameChanged(); - + /// /// No Metadata Documentation available. /// @@ -1067,12 +1067,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("ProductNumber"); OnProductNumberChanged(); } - + } private global::System.String _ProductNumber; partial void OnProductNumberChanging(global::System.String value); partial void OnProductNumberChanged(); - + /// /// No Metadata Documentation available. /// @@ -1092,12 +1092,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("MakeFlag"); OnMakeFlagChanged(); } - + } private global::System.Boolean _MakeFlag; partial void OnMakeFlagChanging(global::System.Boolean value); partial void OnMakeFlagChanged(); - + /// /// No Metadata Documentation available. /// @@ -1117,12 +1117,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("FinishedGoodsFlag"); OnFinishedGoodsFlagChanged(); } - + } private global::System.Boolean _FinishedGoodsFlag; partial void OnFinishedGoodsFlagChanging(global::System.Boolean value); partial void OnFinishedGoodsFlagChanged(); - + /// /// No Metadata Documentation available. /// @@ -1142,12 +1142,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("Color"); OnColorChanged(); } - + } private global::System.String _Color; partial void OnColorChanging(global::System.String value); partial void OnColorChanged(); - + /// /// No Metadata Documentation available. /// @@ -1167,12 +1167,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("SafetyStockLevel"); OnSafetyStockLevelChanged(); } - + } private global::System.Int16 _SafetyStockLevel; partial void OnSafetyStockLevelChanging(global::System.Int16 value); partial void OnSafetyStockLevelChanged(); - + /// /// No Metadata Documentation available. /// @@ -1192,12 +1192,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("ReorderPoint"); OnReorderPointChanged(); } - + } private global::System.Int16 _ReorderPoint; partial void OnReorderPointChanging(global::System.Int16 value); partial void OnReorderPointChanged(); - + /// /// No Metadata Documentation available. /// @@ -1217,12 +1217,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("StandardCost"); OnStandardCostChanged(); } - + } private global::System.Decimal _StandardCost; partial void OnStandardCostChanging(global::System.Decimal value); partial void OnStandardCostChanged(); - + /// /// No Metadata Documentation available. /// @@ -1242,12 +1242,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("ListPrice"); OnListPriceChanged(); } - + } private global::System.Decimal _ListPrice; partial void OnListPriceChanging(global::System.Decimal value); partial void OnListPriceChanged(); - + /// /// No Metadata Documentation available. /// @@ -1267,12 +1267,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("Size"); OnSizeChanged(); } - + } private global::System.String _Size; partial void OnSizeChanging(global::System.String value); partial void OnSizeChanged(); - + /// /// No Metadata Documentation available. /// @@ -1292,12 +1292,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("SizeUnitMeasureCode"); OnSizeUnitMeasureCodeChanged(); } - + } private global::System.String _SizeUnitMeasureCode; partial void OnSizeUnitMeasureCodeChanging(global::System.String value); partial void OnSizeUnitMeasureCodeChanged(); - + /// /// No Metadata Documentation available. /// @@ -1317,12 +1317,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("WeightUnitMeasureCode"); OnWeightUnitMeasureCodeChanged(); } - + } private global::System.String _WeightUnitMeasureCode; partial void OnWeightUnitMeasureCodeChanging(global::System.String value); partial void OnWeightUnitMeasureCodeChanged(); - + /// /// No Metadata Documentation available. /// @@ -1342,12 +1342,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("Weight"); OnWeightChanged(); } - + } private Nullable _Weight; partial void OnWeightChanging(Nullable value); partial void OnWeightChanged(); - + /// /// No Metadata Documentation available. /// @@ -1367,12 +1367,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("DaysToManufacture"); OnDaysToManufactureChanged(); } - + } private global::System.Int32 _DaysToManufacture; partial void OnDaysToManufactureChanging(global::System.Int32 value); partial void OnDaysToManufactureChanged(); - + /// /// No Metadata Documentation available. /// @@ -1392,12 +1392,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("ProductLine"); OnProductLineChanged(); } - + } private global::System.String _ProductLine; partial void OnProductLineChanging(global::System.String value); partial void OnProductLineChanged(); - + /// /// No Metadata Documentation available. /// @@ -1417,12 +1417,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("Class"); OnClassChanged(); } - + } private global::System.String _Class; partial void OnClassChanging(global::System.String value); partial void OnClassChanged(); - + /// /// No Metadata Documentation available. /// @@ -1442,12 +1442,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("Style"); OnStyleChanged(); } - + } private global::System.String _Style; partial void OnStyleChanging(global::System.String value); partial void OnStyleChanged(); - + /// /// No Metadata Documentation available. /// @@ -1467,12 +1467,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("ProductSubcategoryID"); OnProductSubcategoryIDChanged(); } - + } private Nullable _ProductSubcategoryID; partial void OnProductSubcategoryIDChanging(Nullable value); partial void OnProductSubcategoryIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1492,12 +1492,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("ProductModelID"); OnProductModelIDChanged(); } - + } private Nullable _ProductModelID; partial void OnProductModelIDChanging(Nullable value); partial void OnProductModelIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1517,12 +1517,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("SellStartDate"); OnSellStartDateChanged(); } - + } private global::System.DateTime _SellStartDate; partial void OnSellStartDateChanging(global::System.DateTime value); partial void OnSellStartDateChanged(); - + /// /// No Metadata Documentation available. /// @@ -1542,12 +1542,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("SellEndDate"); OnSellEndDateChanged(); } - + } private Nullable _SellEndDate; partial void OnSellEndDateChanging(Nullable value); partial void OnSellEndDateChanged(); - + /// /// No Metadata Documentation available. /// @@ -1567,12 +1567,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("DiscontinuedDate"); OnDiscontinuedDateChanged(); } - + } private Nullable _DiscontinuedDate; partial void OnDiscontinuedDateChanging(Nullable value); partial void OnDiscontinuedDateChanged(); - + /// /// No Metadata Documentation available. /// @@ -1592,12 +1592,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("rowguid"); OnrowguidChanged(); } - + } private global::System.Guid _rowguid; partial void OnrowguidChanging(global::System.Guid value); partial void OnrowguidChanged(); - + /// /// No Metadata Documentation available. /// @@ -1617,16 +1617,16 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("ModifiedDate"); OnModifiedDateChanged(); } - + } private global::System.DateTime _ModifiedDate; partial void OnModifiedDateChanging(global::System.DateTime value); partial void OnModifiedDateChanged(); - + #endregion - + } - + /// /// No Metadata Documentation available. /// @@ -1653,25 +1653,25 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales { SalesOrderDetail salesOrderDetail = new SalesOrderDetail(); salesOrderDetail.SalesOrderID = salesOrderID; - + salesOrderDetail.SalesOrderDetailID = salesOrderDetailID; - + salesOrderDetail.OrderQty = orderQty; - + salesOrderDetail.ProductID = productID; - + salesOrderDetail.SpecialOfferID = specialOfferID; - + salesOrderDetail.UnitPrice = unitPrice; - + salesOrderDetail.UnitPriceDiscount = unitPriceDiscount; - + salesOrderDetail.LineTotal = lineTotal; - + salesOrderDetail.rowguid = rowguid; - + salesOrderDetail.ModifiedDate = modifiedDate; - + return salesOrderDetail; } #endregion @@ -1699,12 +1699,12 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales OnSalesOrderIDChanged(); } } - + } private global::System.Int32 _SalesOrderID; partial void OnSalesOrderIDChanging(global::System.Int32 value); partial void OnSalesOrderIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1727,12 +1727,12 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales OnSalesOrderDetailIDChanged(); } } - + } private global::System.Int32 _SalesOrderDetailID; partial void OnSalesOrderDetailIDChanging(global::System.Int32 value); partial void OnSalesOrderDetailIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1752,12 +1752,12 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales ReportPropertyChanged("CarrierTrackingNumber"); OnCarrierTrackingNumberChanged(); } - + } private global::System.String _CarrierTrackingNumber; partial void OnCarrierTrackingNumberChanging(global::System.String value); partial void OnCarrierTrackingNumberChanged(); - + /// /// No Metadata Documentation available. /// @@ -1777,12 +1777,12 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales ReportPropertyChanged("OrderQty"); OnOrderQtyChanged(); } - + } private global::System.Int16 _OrderQty; partial void OnOrderQtyChanging(global::System.Int16 value); partial void OnOrderQtyChanged(); - + /// /// No Metadata Documentation available. /// @@ -1802,12 +1802,12 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales ReportPropertyChanged("ProductID"); OnProductIDChanged(); } - + } private global::System.Int32 _ProductID; partial void OnProductIDChanging(global::System.Int32 value); partial void OnProductIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1827,12 +1827,12 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales ReportPropertyChanged("SpecialOfferID"); OnSpecialOfferIDChanged(); } - + } private global::System.Int32 _SpecialOfferID; partial void OnSpecialOfferIDChanging(global::System.Int32 value); partial void OnSpecialOfferIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1852,12 +1852,12 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales ReportPropertyChanged("UnitPrice"); OnUnitPriceChanged(); } - + } private global::System.Decimal _UnitPrice; partial void OnUnitPriceChanging(global::System.Decimal value); partial void OnUnitPriceChanged(); - + /// /// No Metadata Documentation available. /// @@ -1877,12 +1877,12 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales ReportPropertyChanged("UnitPriceDiscount"); OnUnitPriceDiscountChanged(); } - + } private global::System.Decimal _UnitPriceDiscount; partial void OnUnitPriceDiscountChanging(global::System.Decimal value); partial void OnUnitPriceDiscountChanged(); - + /// /// No Metadata Documentation available. /// @@ -1902,12 +1902,12 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales ReportPropertyChanged("LineTotal"); OnLineTotalChanged(); } - + } private global::System.Decimal _LineTotal; partial void OnLineTotalChanging(global::System.Decimal value); partial void OnLineTotalChanged(); - + /// /// No Metadata Documentation available. /// @@ -1927,12 +1927,12 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales ReportPropertyChanged("rowguid"); OnrowguidChanged(); } - + } private global::System.Guid _rowguid; partial void OnrowguidChanging(global::System.Guid value); partial void OnrowguidChanged(); - + /// /// No Metadata Documentation available. /// @@ -1952,14 +1952,14 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales ReportPropertyChanged("ModifiedDate"); OnModifiedDateChanged(); } - + } private global::System.DateTime _ModifiedDate; partial void OnModifiedDateChanging(global::System.DateTime value); partial void OnModifiedDateChanged(); - + #endregion - + #region Navigation Properties /// /// No Metadata Documentation available. @@ -1967,7 +1967,7 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderDetail_SalesOrderHeader_SalesOrderID", "SalesOrderHeader")] + [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderDetail_SalesOrderHeader_SalesOrderID", "SalesOrderHeader")] public SalesOrderHeader SalesOrderHeader { get @@ -2000,7 +2000,7 @@ public EntityReference SalesOrderHeaderReference } #endregion } - + /// /// No Metadata Documentation available. /// @@ -2035,41 +2035,41 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales { SalesOrderHeader salesOrderHeader = new SalesOrderHeader(); salesOrderHeader.SalesOrderID = salesOrderID; - + salesOrderHeader.RevisionNumber = revisionNumber; - + salesOrderHeader.OrderDate = orderDate; - + salesOrderHeader.DueDate = dueDate; - + salesOrderHeader.Status = status; - + salesOrderHeader.OnlineOrderFlag = onlineOrderFlag; - + salesOrderHeader.SalesOrderNumber = salesOrderNumber; - + salesOrderHeader.CustomerID = customerID; - + salesOrderHeader.ContactID = contactID; - + salesOrderHeader.BillToAddressID = billToAddressID; - + salesOrderHeader.ShipToAddressID = shipToAddressID; - + salesOrderHeader.ShipMethodID = shipMethodID; - + salesOrderHeader.SubTotal = subTotal; - + salesOrderHeader.TaxAmt = taxAmt; - + salesOrderHeader.Freight = freight; - + salesOrderHeader.TotalDue = totalDue; - + salesOrderHeader.rowguid = rowguid; - + salesOrderHeader.ModifiedDate = modifiedDate; - + return salesOrderHeader; } #endregion @@ -2097,12 +2097,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales OnSalesOrderIDChanged(); } } - + } private global::System.Int32 _SalesOrderID; partial void OnSalesOrderIDChanging(global::System.Int32 value); partial void OnSalesOrderIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2122,12 +2122,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("RevisionNumber"); OnRevisionNumberChanged(); } - + } private global::System.Byte _RevisionNumber; partial void OnRevisionNumberChanging(global::System.Byte value); partial void OnRevisionNumberChanged(); - + /// /// No Metadata Documentation available. /// @@ -2147,12 +2147,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("OrderDate"); OnOrderDateChanged(); } - + } private global::System.DateTime _OrderDate; partial void OnOrderDateChanging(global::System.DateTime value); partial void OnOrderDateChanged(); - + /// /// No Metadata Documentation available. /// @@ -2172,12 +2172,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("DueDate"); OnDueDateChanged(); } - + } private global::System.DateTime _DueDate; partial void OnDueDateChanging(global::System.DateTime value); partial void OnDueDateChanged(); - + /// /// No Metadata Documentation available. /// @@ -2197,12 +2197,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("ShipDate"); OnShipDateChanged(); } - + } private Nullable _ShipDate; partial void OnShipDateChanging(Nullable value); partial void OnShipDateChanged(); - + /// /// No Metadata Documentation available. /// @@ -2222,12 +2222,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("Status"); OnStatusChanged(); } - + } private global::System.Byte _Status; partial void OnStatusChanging(global::System.Byte value); partial void OnStatusChanged(); - + /// /// No Metadata Documentation available. /// @@ -2247,12 +2247,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("OnlineOrderFlag"); OnOnlineOrderFlagChanged(); } - + } private global::System.Boolean _OnlineOrderFlag; partial void OnOnlineOrderFlagChanging(global::System.Boolean value); partial void OnOnlineOrderFlagChanged(); - + /// /// No Metadata Documentation available. /// @@ -2272,12 +2272,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("SalesOrderNumber"); OnSalesOrderNumberChanged(); } - + } private global::System.String _SalesOrderNumber; partial void OnSalesOrderNumberChanging(global::System.String value); partial void OnSalesOrderNumberChanged(); - + /// /// No Metadata Documentation available. /// @@ -2297,12 +2297,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("PurchaseOrderNumber"); OnPurchaseOrderNumberChanged(); } - + } private global::System.String _PurchaseOrderNumber; partial void OnPurchaseOrderNumberChanging(global::System.String value); partial void OnPurchaseOrderNumberChanged(); - + /// /// No Metadata Documentation available. /// @@ -2322,12 +2322,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("AccountNumber"); OnAccountNumberChanged(); } - + } private global::System.String _AccountNumber; partial void OnAccountNumberChanging(global::System.String value); partial void OnAccountNumberChanged(); - + /// /// No Metadata Documentation available. /// @@ -2347,12 +2347,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("CustomerID"); OnCustomerIDChanged(); } - + } private global::System.Int32 _CustomerID; partial void OnCustomerIDChanging(global::System.Int32 value); partial void OnCustomerIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2372,12 +2372,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("ContactID"); OnContactIDChanged(); } - + } private global::System.Int32 _ContactID; partial void OnContactIDChanging(global::System.Int32 value); partial void OnContactIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2397,12 +2397,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("SalesPersonID"); OnSalesPersonIDChanged(); } - + } private Nullable _SalesPersonID; partial void OnSalesPersonIDChanging(Nullable value); partial void OnSalesPersonIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2422,12 +2422,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("TerritoryID"); OnTerritoryIDChanged(); } - + } private Nullable _TerritoryID; partial void OnTerritoryIDChanging(Nullable value); partial void OnTerritoryIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2447,12 +2447,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("BillToAddressID"); OnBillToAddressIDChanged(); } - + } private global::System.Int32 _BillToAddressID; partial void OnBillToAddressIDChanging(global::System.Int32 value); partial void OnBillToAddressIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2472,12 +2472,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("ShipToAddressID"); OnShipToAddressIDChanged(); } - + } private global::System.Int32 _ShipToAddressID; partial void OnShipToAddressIDChanging(global::System.Int32 value); partial void OnShipToAddressIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2497,12 +2497,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("ShipMethodID"); OnShipMethodIDChanged(); } - + } private global::System.Int32 _ShipMethodID; partial void OnShipMethodIDChanging(global::System.Int32 value); partial void OnShipMethodIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2522,12 +2522,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("CreditCardID"); OnCreditCardIDChanged(); } - + } private Nullable _CreditCardID; partial void OnCreditCardIDChanging(Nullable value); partial void OnCreditCardIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2547,12 +2547,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("CreditCardApprovalCode"); OnCreditCardApprovalCodeChanged(); } - + } private global::System.String _CreditCardApprovalCode; partial void OnCreditCardApprovalCodeChanging(global::System.String value); partial void OnCreditCardApprovalCodeChanged(); - + /// /// No Metadata Documentation available. /// @@ -2572,12 +2572,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("CurrencyRateID"); OnCurrencyRateIDChanged(); } - + } private Nullable _CurrencyRateID; partial void OnCurrencyRateIDChanging(Nullable value); partial void OnCurrencyRateIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2597,12 +2597,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("SubTotal"); OnSubTotalChanged(); } - + } private global::System.Decimal _SubTotal; partial void OnSubTotalChanging(global::System.Decimal value); partial void OnSubTotalChanged(); - + /// /// No Metadata Documentation available. /// @@ -2622,12 +2622,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("TaxAmt"); OnTaxAmtChanged(); } - + } private global::System.Decimal _TaxAmt; partial void OnTaxAmtChanging(global::System.Decimal value); partial void OnTaxAmtChanged(); - + /// /// No Metadata Documentation available. /// @@ -2647,12 +2647,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("Freight"); OnFreightChanged(); } - + } private global::System.Decimal _Freight; partial void OnFreightChanging(global::System.Decimal value); partial void OnFreightChanged(); - + /// /// No Metadata Documentation available. /// @@ -2672,12 +2672,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("TotalDue"); OnTotalDueChanged(); } - + } private global::System.Decimal _TotalDue; partial void OnTotalDueChanging(global::System.Decimal value); partial void OnTotalDueChanged(); - + /// /// No Metadata Documentation available. /// @@ -2697,12 +2697,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("Comment"); OnCommentChanged(); } - + } private global::System.String _Comment; partial void OnCommentChanging(global::System.String value); partial void OnCommentChanged(); - + /// /// No Metadata Documentation available. /// @@ -2722,12 +2722,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("rowguid"); OnrowguidChanged(); } - + } private global::System.Guid _rowguid; partial void OnrowguidChanging(global::System.Guid value); partial void OnrowguidChanged(); - + /// /// No Metadata Documentation available. /// @@ -2747,14 +2747,14 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("ModifiedDate"); OnModifiedDateChanged(); } - + } private global::System.DateTime _ModifiedDate; partial void OnModifiedDateChanging(global::System.DateTime value); partial void OnModifiedDateChanged(); - + #endregion - + #region Navigation Properties /// /// No Metadata Documentation available. @@ -2762,7 +2762,7 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Address_BillToAddressID", "Address")] + [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Address_BillToAddressID", "Address")] public Address Address { get @@ -2799,7 +2799,7 @@ public EntityReference
AddressReference [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Address_ShipToAddressID", "Address")] + [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Address_ShipToAddressID", "Address")] public Address Address1 { get @@ -2836,7 +2836,7 @@ public EntityReference
Address1Reference [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Contact_ContactID", "Contact")] + [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Contact_ContactID", "Contact")] public Contact Contact { get @@ -2873,7 +2873,7 @@ public EntityReference ContactReference [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderDetail_SalesOrderHeader_SalesOrderID", "SalesOrderDetail")] + [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderDetail_SalesOrderHeader_SalesOrderID", "SalesOrderDetail")] public EntityCollection SalesOrderDetails { get @@ -2890,7 +2890,7 @@ public EntityCollection SalesOrderDetails } #endregion } - + #endregion - + } diff --git a/samples/snippets/csharp/VS_Snippets_Data/dp conceptualmodelfunctions/cs/school.designer.cs b/samples/snippets/csharp/VS_Snippets_Data/dp conceptualmodelfunctions/cs/school.designer.cs index 1010a1ba0e41b..50195949b585a 100644 --- a/samples/snippets/csharp/VS_Snippets_Data/dp conceptualmodelfunctions/cs/school.designer.cs +++ b/samples/snippets/csharp/VS_Snippets_Data/dp conceptualmodelfunctions/cs/school.designer.cs @@ -43,7 +43,7 @@ public SchoolEntities() : base("name=SchoolEntities", "SchoolEntities") { OnContextCreated(); } - + /// /// Initialize a new SchoolEntities object. /// @@ -51,7 +51,7 @@ public SchoolEntities(string connectionString) : base(connectionString, "SchoolE { OnContextCreated(); } - + /// /// Initialize a new SchoolEntities object. /// @@ -60,11 +60,11 @@ public SchoolEntities(EntityConnection connection) : base(connection, "SchoolEnt OnContextCreated(); } #endregion - + #region Partial Methods partial void OnContextCreated(); #endregion - + #region ObjectSet Properties /// /// No Metadata Documentation available. @@ -81,7 +81,7 @@ public ObjectSet Courses } } private ObjectSet _Courses; - + /// /// No Metadata Documentation available. /// @@ -97,7 +97,7 @@ public ObjectSet Departments } } private ObjectSet _Departments; - + /// /// No Metadata Documentation available. /// @@ -113,7 +113,7 @@ public ObjectSet OfficeAssignments } } private ObjectSet _OfficeAssignments; - + /// /// No Metadata Documentation available. /// @@ -129,7 +129,7 @@ public ObjectSet OnlineCourses } } private ObjectSet _OnlineCourses; - + /// /// No Metadata Documentation available. /// @@ -145,7 +145,7 @@ public ObjectSet OnsiteCourses } } private ObjectSet _OnsiteCourses; - + /// /// No Metadata Documentation available. /// @@ -161,7 +161,7 @@ public ObjectSet People } } private ObjectSet _People; - + /// /// No Metadata Documentation available. /// @@ -177,10 +177,10 @@ public ObjectSet StudentGrades } } private ObjectSet _StudentGrades; - + #endregion #region AddTo Methods - + /// /// Deprecated Method for adding a new object to the Courses EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// @@ -188,7 +188,7 @@ public void AddToCourses(Course course) { base.AddObject("Courses", course); } - + /// /// Deprecated Method for adding a new object to the Departments EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// @@ -196,7 +196,7 @@ public void AddToDepartments(Department department) { base.AddObject("Departments", department); } - + /// /// Deprecated Method for adding a new object to the OfficeAssignments EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// @@ -204,7 +204,7 @@ public void AddToOfficeAssignments(OfficeAssignment officeAssignment) { base.AddObject("OfficeAssignments", officeAssignment); } - + /// /// Deprecated Method for adding a new object to the OnlineCourses EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// @@ -212,7 +212,7 @@ public void AddToOnlineCourses(OnlineCourse onlineCourse) { base.AddObject("OnlineCourses", onlineCourse); } - + /// /// Deprecated Method for adding a new object to the OnsiteCourses EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// @@ -220,7 +220,7 @@ public void AddToOnsiteCourses(OnsiteCourse onsiteCourse) { base.AddObject("OnsiteCourses", onsiteCourse); } - + /// /// Deprecated Method for adding a new object to the People EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// @@ -228,7 +228,7 @@ public void AddToPeople(Person person) { base.AddObject("People", person); } - + /// /// Deprecated Method for adding a new object to the StudentGrades EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// @@ -238,10 +238,10 @@ public void AddToStudentGrades(StudentGrade studentGrade) } #endregion } - + #endregion - - + + #region Entities /// /// No Metadata Documentation available. @@ -263,13 +263,13 @@ public static Course CreateCourse(global::System.Int32 courseID, global::System. { Course course = new Course(); course.CourseID = courseID; - + course.Title = title; - + course.Credits = credits; - + course.DepartmentID = departmentID; - + return course; } #endregion @@ -297,12 +297,12 @@ public static Course CreateCourse(global::System.Int32 courseID, global::System. OnCourseIDChanged(); } } - + } private global::System.Int32 _CourseID; partial void OnCourseIDChanging(global::System.Int32 value); partial void OnCourseIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -322,12 +322,12 @@ public static Course CreateCourse(global::System.Int32 courseID, global::System. ReportPropertyChanged("Title"); OnTitleChanged(); } - + } private global::System.String _Title; partial void OnTitleChanging(global::System.String value); partial void OnTitleChanged(); - + /// /// No Metadata Documentation available. /// @@ -347,12 +347,12 @@ public static Course CreateCourse(global::System.Int32 courseID, global::System. ReportPropertyChanged("Credits"); OnCreditsChanged(); } - + } private global::System.Int32 _Credits; partial void OnCreditsChanging(global::System.Int32 value); partial void OnCreditsChanged(); - + /// /// No Metadata Documentation available. /// @@ -372,14 +372,14 @@ public static Course CreateCourse(global::System.Int32 courseID, global::System. ReportPropertyChanged("DepartmentID"); OnDepartmentIDChanged(); } - + } private global::System.Int32 _DepartmentID; partial void OnDepartmentIDChanging(global::System.Int32 value); partial void OnDepartmentIDChanged(); - + #endregion - + #region Navigation Properties /// /// No Metadata Documentation available. @@ -387,7 +387,7 @@ public static Course CreateCourse(global::System.Int32 courseID, global::System. [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "FK_Course_Department", "Department")] + [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "FK_Course_Department", "Department")] public Department Department { get @@ -424,7 +424,7 @@ public EntityReference DepartmentReference [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "FK_OnlineCourse_Course", "OnlineCourse")] + [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "FK_OnlineCourse_Course", "OnlineCourse")] public OnlineCourse OnlineCourse { get @@ -461,7 +461,7 @@ public EntityReference OnlineCourseReference [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "FK_OnsiteCourse_Course", "OnsiteCourse")] + [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "FK_OnsiteCourse_Course", "OnsiteCourse")] public OnsiteCourse OnsiteCourse { get @@ -498,7 +498,7 @@ public EntityReference OnsiteCourseReference [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "FK_StudentGrade_Course", "StudentGrade")] + [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "FK_StudentGrade_Course", "StudentGrade")] public EntityCollection StudentGrades { get @@ -519,7 +519,7 @@ public EntityCollection StudentGrades [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "CourseInstructor", "Person")] + [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "CourseInstructor", "Person")] public EntityCollection People { get @@ -536,7 +536,7 @@ public EntityCollection People } #endregion } - + /// /// No Metadata Documentation available. /// @@ -557,13 +557,13 @@ public static Department CreateDepartment(global::System.Int32 departmentID, glo { Department department = new Department(); department.DepartmentID = departmentID; - + department.Name = name; - + department.Budget = budget; - + department.StartDate = startDate; - + return department; } #endregion @@ -591,12 +591,12 @@ public static Department CreateDepartment(global::System.Int32 departmentID, glo OnDepartmentIDChanged(); } } - + } private global::System.Int32 _DepartmentID; partial void OnDepartmentIDChanging(global::System.Int32 value); partial void OnDepartmentIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -616,12 +616,12 @@ public static Department CreateDepartment(global::System.Int32 departmentID, glo ReportPropertyChanged("Name"); OnNameChanged(); } - + } private global::System.String _Name; partial void OnNameChanging(global::System.String value); partial void OnNameChanged(); - + /// /// No Metadata Documentation available. /// @@ -641,12 +641,12 @@ public static Department CreateDepartment(global::System.Int32 departmentID, glo ReportPropertyChanged("Budget"); OnBudgetChanged(); } - + } private global::System.Decimal _Budget; partial void OnBudgetChanging(global::System.Decimal value); partial void OnBudgetChanged(); - + /// /// No Metadata Documentation available. /// @@ -666,12 +666,12 @@ public static Department CreateDepartment(global::System.Int32 departmentID, glo ReportPropertyChanged("StartDate"); OnStartDateChanged(); } - + } private global::System.DateTime _StartDate; partial void OnStartDateChanging(global::System.DateTime value); partial void OnStartDateChanged(); - + /// /// No Metadata Documentation available. /// @@ -691,14 +691,14 @@ public static Department CreateDepartment(global::System.Int32 departmentID, glo ReportPropertyChanged("Administrator"); OnAdministratorChanged(); } - + } private Nullable _Administrator; partial void OnAdministratorChanging(Nullable value); partial void OnAdministratorChanged(); - + #endregion - + #region Navigation Properties /// /// No Metadata Documentation available. @@ -706,7 +706,7 @@ public static Department CreateDepartment(global::System.Int32 departmentID, glo [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "FK_Course_Department", "Course")] + [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "FK_Course_Department", "Course")] public EntityCollection Courses { get @@ -723,7 +723,7 @@ public EntityCollection Courses } #endregion } - + /// /// No Metadata Documentation available. /// @@ -743,11 +743,11 @@ public static OfficeAssignment CreateOfficeAssignment(global::System.Int32 instr { OfficeAssignment officeAssignment = new OfficeAssignment(); officeAssignment.InstructorID = instructorID; - + officeAssignment.Location = location; - + officeAssignment.Timestamp = timestamp; - + return officeAssignment; } #endregion @@ -775,12 +775,12 @@ public static OfficeAssignment CreateOfficeAssignment(global::System.Int32 instr OnInstructorIDChanged(); } } - + } private global::System.Int32 _InstructorID; partial void OnInstructorIDChanging(global::System.Int32 value); partial void OnInstructorIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -800,12 +800,12 @@ public static OfficeAssignment CreateOfficeAssignment(global::System.Int32 instr ReportPropertyChanged("Location"); OnLocationChanged(); } - + } private global::System.String _Location; partial void OnLocationChanging(global::System.String value); partial void OnLocationChanged(); - + /// /// No Metadata Documentation available. /// @@ -825,14 +825,14 @@ public static OfficeAssignment CreateOfficeAssignment(global::System.Int32 instr ReportPropertyChanged("Timestamp"); OnTimestampChanged(); } - + } private global::System.Byte[] _Timestamp; partial void OnTimestampChanging(global::System.Byte[] value); partial void OnTimestampChanged(); - + #endregion - + #region Navigation Properties /// /// No Metadata Documentation available. @@ -840,7 +840,7 @@ public static OfficeAssignment CreateOfficeAssignment(global::System.Int32 instr [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "FK_OfficeAssignment_Person", "Person")] + [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "FK_OfficeAssignment_Person", "Person")] public Person Person { get @@ -873,7 +873,7 @@ public EntityReference PersonReference } #endregion } - + /// /// No Metadata Documentation available. /// @@ -892,9 +892,9 @@ public static OnlineCourse CreateOnlineCourse(global::System.Int32 courseID, glo { OnlineCourse onlineCourse = new OnlineCourse(); onlineCourse.CourseID = courseID; - + onlineCourse.URL = uRL; - + return onlineCourse; } #endregion @@ -922,12 +922,12 @@ public static OnlineCourse CreateOnlineCourse(global::System.Int32 courseID, glo OnCourseIDChanged(); } } - + } private global::System.Int32 _CourseID; partial void OnCourseIDChanging(global::System.Int32 value); partial void OnCourseIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -947,14 +947,14 @@ public static OnlineCourse CreateOnlineCourse(global::System.Int32 courseID, glo ReportPropertyChanged("URL"); OnURLChanged(); } - + } private global::System.String _URL; partial void OnURLChanging(global::System.String value); partial void OnURLChanged(); - + #endregion - + #region Navigation Properties /// /// No Metadata Documentation available. @@ -962,7 +962,7 @@ public static OnlineCourse CreateOnlineCourse(global::System.Int32 courseID, glo [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "FK_OnlineCourse_Course", "Course")] + [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "FK_OnlineCourse_Course", "Course")] public Course Course { get @@ -995,7 +995,7 @@ public EntityReference CourseReference } #endregion } - + /// /// No Metadata Documentation available. /// @@ -1016,13 +1016,13 @@ public static OnsiteCourse CreateOnsiteCourse(global::System.Int32 courseID, glo { OnsiteCourse onsiteCourse = new OnsiteCourse(); onsiteCourse.CourseID = courseID; - + onsiteCourse.Location = location; - + onsiteCourse.Days = days; - + onsiteCourse.Time = time; - + return onsiteCourse; } #endregion @@ -1050,12 +1050,12 @@ public static OnsiteCourse CreateOnsiteCourse(global::System.Int32 courseID, glo OnCourseIDChanged(); } } - + } private global::System.Int32 _CourseID; partial void OnCourseIDChanging(global::System.Int32 value); partial void OnCourseIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1075,12 +1075,12 @@ public static OnsiteCourse CreateOnsiteCourse(global::System.Int32 courseID, glo ReportPropertyChanged("Location"); OnLocationChanged(); } - + } private global::System.String _Location; partial void OnLocationChanging(global::System.String value); partial void OnLocationChanged(); - + /// /// No Metadata Documentation available. /// @@ -1100,12 +1100,12 @@ public static OnsiteCourse CreateOnsiteCourse(global::System.Int32 courseID, glo ReportPropertyChanged("Days"); OnDaysChanged(); } - + } private global::System.String _Days; partial void OnDaysChanging(global::System.String value); partial void OnDaysChanged(); - + /// /// No Metadata Documentation available. /// @@ -1125,14 +1125,14 @@ public static OnsiteCourse CreateOnsiteCourse(global::System.Int32 courseID, glo ReportPropertyChanged("Time"); OnTimeChanged(); } - + } private global::System.DateTime _Time; partial void OnTimeChanging(global::System.DateTime value); partial void OnTimeChanged(); - + #endregion - + #region Navigation Properties /// /// No Metadata Documentation available. @@ -1140,7 +1140,7 @@ public static OnsiteCourse CreateOnsiteCourse(global::System.Int32 courseID, glo [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "FK_OnsiteCourse_Course", "Course")] + [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "FK_OnsiteCourse_Course", "Course")] public Course Course { get @@ -1173,7 +1173,7 @@ public EntityReference CourseReference } #endregion } - + /// /// No Metadata Documentation available. /// @@ -1193,11 +1193,11 @@ public static Person CreatePerson(global::System.Int32 personID, global::System. { Person person = new Person(); person.PersonID = personID; - + person.LastName = lastName; - + person.FirstName = firstName; - + return person; } #endregion @@ -1225,12 +1225,12 @@ public static Person CreatePerson(global::System.Int32 personID, global::System. OnPersonIDChanged(); } } - + } private global::System.Int32 _PersonID; partial void OnPersonIDChanging(global::System.Int32 value); partial void OnPersonIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1250,12 +1250,12 @@ public static Person CreatePerson(global::System.Int32 personID, global::System. ReportPropertyChanged("LastName"); OnLastNameChanged(); } - + } private global::System.String _LastName; partial void OnLastNameChanging(global::System.String value); partial void OnLastNameChanged(); - + /// /// No Metadata Documentation available. /// @@ -1275,12 +1275,12 @@ public static Person CreatePerson(global::System.Int32 personID, global::System. ReportPropertyChanged("FirstName"); OnFirstNameChanged(); } - + } private global::System.String _FirstName; partial void OnFirstNameChanging(global::System.String value); partial void OnFirstNameChanged(); - + /// /// No Metadata Documentation available. /// @@ -1300,12 +1300,12 @@ public static Person CreatePerson(global::System.Int32 personID, global::System. ReportPropertyChanged("HireDate"); OnHireDateChanged(); } - + } private Nullable _HireDate; partial void OnHireDateChanging(Nullable value); partial void OnHireDateChanged(); - + /// /// No Metadata Documentation available. /// @@ -1325,14 +1325,14 @@ public static Person CreatePerson(global::System.Int32 personID, global::System. ReportPropertyChanged("EnrollmentDate"); OnEnrollmentDateChanged(); } - + } private Nullable _EnrollmentDate; partial void OnEnrollmentDateChanging(Nullable value); partial void OnEnrollmentDateChanged(); - + #endregion - + #region Navigation Properties /// /// No Metadata Documentation available. @@ -1340,7 +1340,7 @@ public static Person CreatePerson(global::System.Int32 personID, global::System. [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "FK_OfficeAssignment_Person", "OfficeAssignment")] + [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "FK_OfficeAssignment_Person", "OfficeAssignment")] public OfficeAssignment OfficeAssignment { get @@ -1377,7 +1377,7 @@ public EntityReference OfficeAssignmentReference [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "FK_StudentGrade_Student", "StudentGrade")] + [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "FK_StudentGrade_Student", "StudentGrade")] public EntityCollection StudentGrades { get @@ -1398,7 +1398,7 @@ public EntityCollection StudentGrades [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "CourseInstructor", "Course")] + [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "CourseInstructor", "Course")] public EntityCollection Courses { get @@ -1415,7 +1415,7 @@ public EntityCollection Courses } #endregion } - + /// /// No Metadata Documentation available. /// @@ -1435,11 +1435,11 @@ public static StudentGrade CreateStudentGrade(global::System.Int32 enrollmentID, { StudentGrade studentGrade = new StudentGrade(); studentGrade.EnrollmentID = enrollmentID; - + studentGrade.CourseID = courseID; - + studentGrade.StudentID = studentID; - + return studentGrade; } #endregion @@ -1467,12 +1467,12 @@ public static StudentGrade CreateStudentGrade(global::System.Int32 enrollmentID, OnEnrollmentIDChanged(); } } - + } private global::System.Int32 _EnrollmentID; partial void OnEnrollmentIDChanging(global::System.Int32 value); partial void OnEnrollmentIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1492,12 +1492,12 @@ public static StudentGrade CreateStudentGrade(global::System.Int32 enrollmentID, ReportPropertyChanged("CourseID"); OnCourseIDChanged(); } - + } private global::System.Int32 _CourseID; partial void OnCourseIDChanging(global::System.Int32 value); partial void OnCourseIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1517,12 +1517,12 @@ public static StudentGrade CreateStudentGrade(global::System.Int32 enrollmentID, ReportPropertyChanged("StudentID"); OnStudentIDChanged(); } - + } private global::System.Int32 _StudentID; partial void OnStudentIDChanging(global::System.Int32 value); partial void OnStudentIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1542,14 +1542,14 @@ public static StudentGrade CreateStudentGrade(global::System.Int32 enrollmentID, ReportPropertyChanged("Grade"); OnGradeChanged(); } - + } private Nullable _Grade; partial void OnGradeChanging(Nullable value); partial void OnGradeChanged(); - + #endregion - + #region Navigation Properties /// /// No Metadata Documentation available. @@ -1557,7 +1557,7 @@ public static StudentGrade CreateStudentGrade(global::System.Int32 enrollmentID, [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "FK_StudentGrade_Course", "Course")] + [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "FK_StudentGrade_Course", "Course")] public Course Course { get @@ -1594,7 +1594,7 @@ public EntityReference CourseReference [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "FK_StudentGrade_Student", "Person")] + [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "FK_StudentGrade_Student", "Person")] public Person Person { get @@ -1627,7 +1627,7 @@ public EntityReference PersonReference } #endregion } - + #endregion - + } diff --git a/samples/snippets/csharp/VS_Snippets_Data/dp entityservices concepts 2/cs/entitysql.cs b/samples/snippets/csharp/VS_Snippets_Data/dp entityservices concepts 2/cs/entitysql.cs index 941e360674dcf..c23efddd9786c 100644 --- a/samples/snippets/csharp/VS_Snippets_Data/dp entityservices concepts 2/cs/entitysql.cs +++ b/samples/snippets/csharp/VS_Snippets_Data/dp entityservices concepts 2/cs/entitysql.cs @@ -20,11 +20,11 @@ public static void TestEntitySQL() Dictionary pc = new Dictionary(); /* // - SELECT VALUE product FROM AdventureWorksEntities.Products AS product + SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice = @price1 + @price2 // */ - string queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products AS product + string queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice = @price1 + @price2"; pc.Add("price1", 120); @@ -41,22 +41,22 @@ SELECT VALUE Product FROM AdventureWorksEntities.Products AS Product /* // - SELECT VALUE 'Name=[' + e.Name + ']' FROM + SELECT VALUE 'Name=[' + e.Name + ']' FROM AdventureWorksEntities.Products AS e // */ - queryString = @"SELECT VALUE 'Name=[' + e.Name + ']' FROM + queryString = @"SELECT VALUE 'Name=[' + e.Name + ']' FROM AdventureWorksEntities.Products AS e"; TestProduct(queryString, pc); /* // - SELECT VALUE product FROM AdventureWorksEntities.Products + SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice = -(-@price) // */ - queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products + queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice = -(-@price)"; pc.Add("price", 120); @@ -65,11 +65,11 @@ SELECT VALUE product FROM AdventureWorksEntities.Products /* // - SELECT VALUE product FROM AdventureWorksEntities.Products + SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice = @price1 - @price2 // */ - queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products + queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice = @price1 - @price2"; pc.Add("price1", 127); pc.Add("price2", 2); @@ -78,11 +78,11 @@ SELECT VALUE product FROM AdventureWorksEntities.Products /* // - SELECT VALUE product FROM AdventureWorksEntities.Products + SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice = @price1 * @price2 // */ - queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products + queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice = @price1 * @price2"; pc.Add("price1", 25); pc.Add("price2", 5); @@ -91,11 +91,11 @@ SELECT VALUE product FROM AdventureWorksEntities.Products /* // - SELECT VALUE product FROM AdventureWorksEntities.Products + SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice = @price1 / @price2 // */ - queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products + queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice = @price1 / @price2"; pc.Add("price1", 120); pc.Add("price2", 2); @@ -104,11 +104,11 @@ SELECT VALUE product FROM AdventureWorksEntities.Products /* // - SELECT VALUE product FROM AdventureWorksEntities.Products + SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice = @price1 % @price2 // */ - queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products + queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice = @price1 % @price2"; pc.Add("price1", 125); pc.Add("price2", 1); @@ -117,14 +117,14 @@ SELECT VALUE product FROM AdventureWorksEntities.Products /* // -- AND - SELECT VALUE product FROM AdventureWorksEntities.Products + SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice > @price1 AND product.ListPrice < @price2 - -- && - SELECT VALUE product FROM AdventureWorksEntities.Products + -- && + SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice > @price1 && product.ListPrice < @price2 // */ - queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products + queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice > @price1 AND product.ListPrice < @price2"; pc.Add("price1", 10); @@ -135,14 +135,14 @@ AS product where product.ListPrice > @price1 && product.ListPrice < @price2 /* // -- OR - SELECT VALUE product FROM AdventureWorksEntities.Products + SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice = @price1 OR product.ListPrice = @price2 - -- || - SELECT VALUE product FROM AdventureWorksEntities.Products + -- || + SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice = @price1 || product.ListPrice = @price2 // */ - queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products + queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice = @price1 OR product.ListPrice = @price2"; pc.Add("price1", 40); pc.Add("price2", 125); @@ -151,14 +151,14 @@ SELECT VALUE product FROM AdventureWorksEntities.Products /* // -- NOT - SELECT VALUE product FROM AdventureWorksEntities.Products + SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice > @price1 AND NOT (product.ListPrice = @price2) -- ! - SELECT VALUE product FROM AdventureWorksEntities.Products + SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice > @price1 AND ! (product.ListPrice = @price2) // */ - queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products + queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice > @price1 AND NOT (product.ListPrice = @price2)"; pc.Add("price1", 50); pc.Add("price2", 90); @@ -167,11 +167,11 @@ SELECT VALUE product FROM AdventureWorksEntities.Products /* // - SELECT VALUE product FROM AdventureWorksEntities.Products + SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice = @price // */ - queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products + queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice = @price"; pc.Add("price", 125); @@ -179,11 +179,11 @@ SELECT VALUE product FROM AdventureWorksEntities.Products pc.Clear(); /* // - SELECT VALUE product FROM AdventureWorksEntities.Products + SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice > @price // */ - queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products + queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice > @price"; pc.Add("price", 125); TestProduct(queryString, pc); @@ -191,11 +191,11 @@ AS product where product.ListPrice > @price /* // - SELECT VALUE product FROM AdventureWorksEntities.Products + SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice >= @price // */ - queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products + queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice >= @price"; pc.Add("price", 125); TestProduct(queryString, pc); @@ -203,11 +203,11 @@ SELECT VALUE product FROM AdventureWorksEntities.Products /* // - SELECT VALUE product FROM AdventureWorksEntities.Products + SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice < @price // */ - queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products + queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice < @price"; pc.Add("price", 125); TestProduct(queryString, pc); @@ -215,11 +215,11 @@ AS product where product.ListPrice < @price /* // - SELECT VALUE product FROM AdventureWorksEntities.Products + SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice <= @price // */ - queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products + queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice <= @price"; pc.Add("price", 125); TestProduct(queryString, pc); @@ -228,16 +228,16 @@ SELECT VALUE product FROM AdventureWorksEntities.Products /* // -- != - SELECT VALUE product FROM AdventureWorksEntities.Products + SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice != @price -- <> - SELECT VALUE product FROM AdventureWorksEntities.Products + SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice <> @price // */ - queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products + queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice != @price"; - + pc.Add("price", 0); TestProduct(queryString, pc); pc.Clear(); @@ -260,20 +260,20 @@ SELECT VALUE product FROM AdventureWorksEntities.Products AS product -- add a co pc.Add("price", 125); TestProduct(queryString, pc); pc.Clear(); - + /* // - SELECT VALUE product FROM AdventureWorksEntities.Products + SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice BETWEEN @price1 AND @price2 // */ - queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products + queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice BETWEEN @price1 AND @price2"; pc.Add("price1", 50); pc.Add("price2", 90); TestProduct(queryString, pc); - pc.Clear(); - + pc.Clear(); + /* // CASE WHEN AVG({@score1,@score2,@score3}) < @total THEN TRUE ELSE FALSE END @@ -285,27 +285,27 @@ CASE WHEN AVG({@score1,@score2,@score3}) < @total THEN TRUE ELSE FALSE END pc.Add("score3", 11); pc.Add("total", 100); TestProduct(queryString, pc); - pc.Clear(); - + pc.Clear(); + /* // - SELECT VALUE cast(p.ListPrice as Edm.Int32) + SELECT VALUE cast(p.ListPrice as Edm.Int32) FROM AdventureWorksEntities.Products as p order by p.ListPrice // */ - queryString = @"SELECT VALUE cast(p.ListPrice as Edm.Int32) + queryString = @"SELECT VALUE cast(p.ListPrice as Edm.Int32) FROM AdventureWorksEntities.Products as p order by p.ListPrice"; /* // - SELECT VALUE Key(CreateRef(AdventureWorksEntities.Products, + SELECT VALUE Key(CreateRef(AdventureWorksEntities.Products, row(p.ProductID))) FROM AdventureWorksEntities.Products as p // */ - queryString = @"SELECT VALUE Key(CreateRef(AdventureWorksEntities.Products, + queryString = @"SELECT VALUE Key(CreateRef(AdventureWorksEntities.Products, row(p.ProductID))) FROM AdventureWorksEntities.Products as p"; /* // - SELECT VALUE DEREF(REF(p)).Name FROM AdventureWorksEntities.Products + SELECT VALUE DEREF(REF(p)).Name FROM AdventureWorksEntities.Products as p // */ @@ -313,15 +313,15 @@ as p /* // - (SELECT product from AdventureWorksEntities.Products as product - WHERE product.ListPrice > @price1 ) except - (select product from AdventureWorksEntities.Products as product + (SELECT product from AdventureWorksEntities.Products as product + WHERE product.ListPrice > @price1 ) except + (select product from AdventureWorksEntities.Products as product WHERE product.ListPrice > @price2) // */ - queryString = @"(SELECT product from AdventureWorksEntities.Products as product - WHERE product.ListPrice > @price1 ) except - (select product from AdventureWorksEntities.Products as product + queryString = @"(SELECT product from AdventureWorksEntities.Products as product + WHERE product.ListPrice > @price1 ) except + (select product from AdventureWorksEntities.Products as product WHERE product.ListPrice > @price2)"; pc.Add("price1", 20); pc.Add("price2", 50); @@ -330,13 +330,13 @@ as p /* // - SELECT VALUE name from AdventureWorksEntities.Products - AS name where exists(SELECT A from AdventureWorksEntities.Products + SELECT VALUE name from AdventureWorksEntities.Products + AS name where exists(SELECT A from AdventureWorksEntities.Products as A WHERE A.ListPrice < @price1) // */ - queryString = @"SELECT VALUE name from AdventureWorksEntities.Products - AS name where exists(SELECT A from AdventureWorksEntities.Products + queryString = @"SELECT VALUE name from AdventureWorksEntities.Products + AS name where exists(SELECT A from AdventureWorksEntities.Products as A WHERE A.ListPrice < @price)"; pc.Add("price", 20); TestProduct(queryString, pc); @@ -344,17 +344,17 @@ AS name where exists(SELECT A from AdventureWorksEntities.Products /* // - FLATTEN(SELECT VALUE c.SalesOrderHeaders From + FLATTEN(SELECT VALUE c.SalesOrderHeaders From AdventureWorksEntities.Contacts as c) // */ - queryString = @"FLATTEN(SELECT VALUE c.SalesOrderHeaders From + queryString = @"FLATTEN(SELECT VALUE c.SalesOrderHeaders From AdventureWorksEntities.Contacts as c)"; /* // USING Microsoft.Samples.Entity; - FUNCTION Products(listPrice Int32) AS + FUNCTION Products(listPrice Int32) AS ( SELECT VALUE p FROM AdventureWorksEntities.Products AS p WHERE p.ListPrice >= listPrice ) @@ -362,7 +362,7 @@ select p from Products(@price) as p // */ queryString = @"USING Microsoft.Samples.Entity; - FUNCTION Products(listPrice Int32) AS + FUNCTION Products(listPrice Int32) AS ( SELECT VALUE p FROM AdventureWorksEntities.Products AS p WHERE p.ListPrice >= listPrice ) @@ -374,7 +374,7 @@ FUNCTION Products(listPrice Int32) AS /* // USING Microsoft.Samples.Entity; - FUNCTION GetSpecificContacts(Ids Collection(Int32)) AS + FUNCTION GetSpecificContacts(Ids Collection(Int32)) AS ( SELECT VALUE id FROM Ids AS id WHERE id < @price ) @@ -383,7 +383,7 @@ SELECT VALUE id FROM Ids AS id WHERE id < @price */ queryString = @" USING Microsoft.Samples.Entity; - FUNCTION GetSpecificContacts(Ids Collection(Int32)) AS + FUNCTION GetSpecificContacts(Ids Collection(Int32)) AS ( SELECT VALUE id FROM Ids AS id WHERE id < @price ) @@ -395,41 +395,41 @@ SELECT VALUE id FROM Ids AS id WHERE id < @price /* // - SELECT VALUE name FROM AdventureWorksEntities.Products + SELECT VALUE name FROM AdventureWorksEntities.Products as P GROUP BY P.Name HAVING MAX(P.ListPrice) > @price // */ - queryString = @"SELECT VALUE name FROM AdventureWorksEntities.Products + queryString = @"SELECT VALUE name FROM AdventureWorksEntities.Products as P GROUP BY P.Name HAVING MAX(P.ListPrice) > @price"; pc.Add("price", 10); TestProduct(queryString, pc); pc.Clear(); /* // - SELECT VALUE name FROM AdventureWorksEntities.Products + SELECT VALUE name FROM AdventureWorksEntities.Products as P GROUP BY P.Name HAVING MAX(P.ListPrice) > @price // */ - queryString = @"SELECT VALUE name FROM AdventureWorksEntities.Products + queryString = @"SELECT VALUE name FROM AdventureWorksEntities.Products as P GROUP BY P.Name HAVING MAX(P.ListPrice) > @price"; pc.Add("price", 10); TestProduct(queryString, pc); pc.Clear(); /* // - SELECT VALUE Key(CreateRef(AdventureWorksEntities.Products, + SELECT VALUE Key(CreateRef(AdventureWorksEntities.Products, row(p.ProductID))) FROM AdventureWorksEntities.Products as p // */ - queryString = @"SELECT VALUE Key(CreateRef(AdventureWorksEntities.Products, + queryString = @"SELECT VALUE Key(CreateRef(AdventureWorksEntities.Products, row(p.ProductID))) FROM AdventureWorksEntities.Products as p"; /* // - SELECT VALUE product FROM AdventureWorksEntities.Products + SELECT VALUE product FROM AdventureWorksEntities.Products AS product WHERE product.ListPrice IN {125, 300} // */ - queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products + queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products AS product WHERE product.ListPrice IN {@price1, @price2}"; pc.Add("price1", 125); pc.Add("price2", 300); @@ -437,13 +437,13 @@ SELECT VALUE product FROM AdventureWorksEntities.Products pc.Clear(); /* // - (SELECT product from AdventureWorksEntities.Products as product where product.ListPrice > @price1 ) - intersect (select product from AdventureWorksEntities.Products as + (SELECT product from AdventureWorksEntities.Products as product where product.ListPrice > @price1 ) + intersect (select product from AdventureWorksEntities.Products as product where product.ListPrice > @price2) // */ - queryString = @"(SELECT product from AdventureWorksEntities.Products as product where product.ListPrice > @price1 ) - intersect (select product from AdventureWorksEntities.Products as + queryString = @"(SELECT product from AdventureWorksEntities.Products as product where product.ListPrice > @price1 ) + intersect (select product from AdventureWorksEntities.Products as product where product.ListPrice > @price2)"; pc.Add("price1", 10); pc.Add("price2", 20); @@ -452,35 +452,35 @@ SELECT VALUE product FROM AdventureWorksEntities.Products /* // - SELECT VALUE product FROM AdventureWorksEntities.Products + SELECT VALUE product FROM AdventureWorksEntities.Products AS product WHERE product.Color IS NOT NULL // */ - queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products + queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products AS product WHERE product.Color IS NOT NULL"; /* // -- LIKE and ESCAPE - -- If an AdventureWorksEntities.Products contained a Name - -- with the value 'Down_Tube', the following query would find that + -- If an AdventureWorksEntities.Products contained a Name + -- with the value 'Down_Tube', the following query would find that -- value. - Select value P.Name FROM AdventureWorksEntities.Products + Select value P.Name FROM AdventureWorksEntities.Products as P where P.Name LIKE 'DownA_%' ESCAPE 'A' -- LIKE - Select value P.Name FROM AdventureWorksEntities.Products + Select value P.Name FROM AdventureWorksEntities.Products as P where P.Name like 'BB%' // */ - queryString = @"Select value P.Name FROM AdventureWorksEntities.Products + queryString = @"Select value P.Name FROM AdventureWorksEntities.Products as P where P.Name like 'BB%'"; /* // - SELECT VALUE p FROM AdventureWorksEntities.Products + SELECT VALUE p FROM AdventureWorksEntities.Products AS p order by p.ListPrice LIMIT(@limit) // */ - queryString = @"SELECT VALUE p FROM AdventureWorksEntities.Products + queryString = @"SELECT VALUE p FROM AdventureWorksEntities.Products AS p order by p.ListPrice LIMIT(@limit)"; pc.Add("limit", 5); TestProduct(queryString, pc); @@ -488,11 +488,11 @@ AS p order by p.ListPrice LIMIT(@limit) /* // - SELECT VALUE product FROM AdventureWorksEntities.Products + SELECT VALUE product FROM AdventureWorksEntities.Products AS product WHERE product.ListPrice IN MultiSet (@price1, @price2) // */ - queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products + queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products AS product WHERE product.ListPrice IN MultiSet (@price1, @price2)"; pc.Add("price1", 125); pc.Add("price2", 300); @@ -516,42 +516,42 @@ FROM AdventureWorksEntities.SalesOrderDetails AS o FROM AdventureWorksEntities.SalesOrderDetails AS o"; /* // - SELECT address.AddressID, (SELECT VALUE DEREF(soh) + SELECT address.AddressID, (SELECT VALUE DEREF(soh) FROM NAVIGATE(address, AdventureWorksModel.FK_SalesOrderHeader_Address_BillToAddressID) AS soh) FROM AdventureWorksEntities.Addresses AS address // */ - queryString = @"SELECT address.AddressID, (SELECT VALUE DEREF(soh) + queryString = @"SELECT address.AddressID, (SELECT VALUE DEREF(soh) FROM NAVIGATE(address, AdventureWorksModel.FK_SalesOrderHeader_Address_BillToAddressID) AS soh) FROM AdventureWorksEntities.Addresses AS address"; /* // - SELECT onsiteCourse.Location FROM - OFTYPE(SchoolEntities.Courses, SchoolModel.OnsiteCourse) - AS onsiteCourse + SELECT onsiteCourse.Location FROM + OFTYPE(SchoolEntities.Courses, SchoolModel.OnsiteCourse) + AS onsiteCourse // */ - queryString = @"SELECT onsiteCourse.Location FROM - OFTYPE(SchoolEntities.Courses, SchoolModel.OnsiteCourse) + queryString = @"SELECT onsiteCourse.Location FROM + OFTYPE(SchoolEntities.Courses, SchoolModel.OnsiteCourse) AS onsiteCourse"; /* // - SELECT VALUE p FROM AdventureWorksEntities.Products + SELECT VALUE p FROM AdventureWorksEntities.Products AS p order by p.ListPrice // */ - queryString = @"SELECT VALUE p FROM AdventureWorksEntities.Products + queryString = @"SELECT VALUE p FROM AdventureWorksEntities.Products AS p order by p.ListPrice"; /* // - SELECT value P from AdventureWorksEntities.Products - as P WHERE ((select P from AdventureWorksEntities.Products + SELECT value P from AdventureWorksEntities.Products + as P WHERE ((select P from AdventureWorksEntities.Products as P WHERE P.ListPrice > @price1) overlaps (select P from AdventureWorksEntities.Products as P WHERE P.ListPrice < @price2)) // */ - queryString = @"SELECT value P from AdventureWorksEntities.Products - as P WHERE ((select P from AdventureWorksEntities.Products + queryString = @"SELECT value P from AdventureWorksEntities.Products + as P WHERE ((select P from AdventureWorksEntities.Products as P WHERE P.ListPrice > @price1) overlaps (select P from AdventureWorksEntities.Products as P WHERE P.ListPrice < @price2))"; pc.Add("price1", 10); @@ -601,11 +601,11 @@ AS product queryString = @"SET(SELECT VALUE P.Name FROM AdventureWorksEntities.Products AS P)"; /* // - SELECT VALUE p FROM AdventureWorksEntities.Products + SELECT VALUE p FROM AdventureWorksEntities.Products AS p order by p.ListPrice SKIP(@price) // */ - queryString = @"SELECT VALUE p FROM AdventureWorksEntities.Products + queryString = @"SELECT VALUE p FROM AdventureWorksEntities.Products AS p order by p.ListPrice SKIP(@price)"; pc.Add("price", 10); TestProduct(queryString, pc); @@ -619,25 +619,25 @@ SELECT VALUE TOP(1) contact FROM AdventureWorksEntities.Contacts AS contact queryString = @"SELECT VALUE TOP(1) contact FROM AdventureWorksEntities.Contacts AS contact"; /* // - SELECT VALUE TREAT (course as SchoolModel.OnsiteCourse) + SELECT VALUE TREAT (course as SchoolModel.OnsiteCourse) FROM SchoolEntities.Courses as course WHERE course IS OF( SchoolModel.OnsiteCourse) // */ - queryString = @"SELECT VALUE TREAT (course as SchoolModel.OnsiteCourse) + queryString = @"SELECT VALUE TREAT (course as SchoolModel.OnsiteCourse) FROM SchoolEntities.Courses as course WHERE course IS OF( SchoolModel.OnsiteCourse)"; /* // - (SELECT VALUE P from AdventureWorksEntities.Products - as P WHERE P.Name LIKE 'C%') Union All - ( SELECT VALUE A from AdventureWorksEntities.Products + (SELECT VALUE P from AdventureWorksEntities.Products + as P WHERE P.Name LIKE 'C%') Union All + ( SELECT VALUE A from AdventureWorksEntities.Products as A WHERE A.ListPrice > @price) // */ - queryString = @"(SELECT VALUE P from AdventureWorksEntities.Products - as P WHERE P.Name LIKE 'C%') Union All - ( SELECT VALUE A from AdventureWorksEntities.Products + queryString = @"(SELECT VALUE P from AdventureWorksEntities.Products + as P WHERE P.Name LIKE 'C%') Union All + ( SELECT VALUE A from AdventureWorksEntities.Products as A WHERE A.ListPrice > @price)"; pc.Add("price", 10); TestProduct(queryString, pc); @@ -645,75 +645,75 @@ FROM SchoolEntities.Courses as course /* // - SELECT VALUE AVG(p.ListPrice) FROM AdventureWorksEntities.Products as p + SELECT VALUE AVG(p.ListPrice) FROM AdventureWorksEntities.Products as p // */ queryString = @"SELECT VALUE AVG(p.ListPrice) FROM AdventureWorksEntities.Products as p "; /* // - SELECT VALUE BigCount(p.ProductID) FROM AdventureWorksEntities.Products as p + SELECT VALUE BigCount(p.ProductID) FROM AdventureWorksEntities.Products as p // */ queryString = @"SELECT VALUE BigCount(p.ProductID) FROM AdventureWorksEntities.Products as p "; /* // - SELECT VALUE Count(p.ProductID) FROM AdventureWorksEntities.Products as p + SELECT VALUE Count(p.ProductID) FROM AdventureWorksEntities.Products as p // */ queryString = @"SELECT VALUE Count(p.ProductID) FROM AdventureWorksEntities.Products as p "; /* // - SELECT VALUE MAX(p.ListPrice) FROM AdventureWorksEntities.Products as p + SELECT VALUE MAX(p.ListPrice) FROM AdventureWorksEntities.Products as p // */ queryString = @"SELECT VALUE MAX(p.ListPrice) FROM AdventureWorksEntities.Products as p "; /* // - SELECT VALUE MIN(p.ListPrice) FROM AdventureWorksEntities.Products as p + SELECT VALUE MIN(p.ListPrice) FROM AdventureWorksEntities.Products as p // */ queryString = @"SELECT VALUE MIN(p.ListPrice) FROM AdventureWorksEntities.Products as p "; /* // - SELECT VALUE StDev(product.ListPrice) - FROM AdventureWorksEntities.Products AS product + SELECT VALUE StDev(product.ListPrice) + FROM AdventureWorksEntities.Products AS product where product.ListPrice > @price // */ - queryString = @"SELECT VALUE StDev(product.ListPrice) - FROM AdventureWorksEntities.Products AS product + queryString = @"SELECT VALUE StDev(product.ListPrice) + FROM AdventureWorksEntities.Products AS product where product.ListPrice > @price"; pc.Add("price", 20); TestProduct(queryString, pc); pc.Clear(); /* // - SELECT VALUE StDevP(product.ListPrice) - FROM AdventureWorksEntities.Products AS product + SELECT VALUE StDevP(product.ListPrice) + FROM AdventureWorksEntities.Products AS product where product.ListPrice > @price // */ - queryString = @"SELECT VALUE StDevP(product.ListPrice) - FROM AdventureWorksEntities.Products AS product + queryString = @"SELECT VALUE StDevP(product.ListPrice) + FROM AdventureWorksEntities.Products AS product where product.ListPrice > @price"; pc.Add("price", 20); TestProduct(queryString, pc); pc.Clear(); /* // - SELECT VALUE Sum(p.ListPrice) FROM AdventureWorksEntities.Products as p + SELECT VALUE Sum(p.ListPrice) FROM AdventureWorksEntities.Products as p // */ queryString = @"SELECT VALUE Sum(p.ListPrice) FROM AdventureWorksEntities.Products as p "; /* // - SELECT VALUE Var(product.ListPrice) - FROM AdventureWorksEntities.Products AS product + SELECT VALUE Var(product.ListPrice) + FROM AdventureWorksEntities.Products AS product WHERE product.ListPrice > @price // */ - queryString = @"SELECT VALUE Var(product.ListPrice) - FROM AdventureWorksEntities.Products AS product + queryString = @"SELECT VALUE Var(product.ListPrice) + FROM AdventureWorksEntities.Products AS product WHERE product.ListPrice > @price"; pc.Add("price", 20); TestProduct(queryString, pc); @@ -721,13 +721,13 @@ FROM AdventureWorksEntities.Products AS product /* // - SELECT VALUE VarP(product.ListPrice) - FROM AdventureWorksEntities.Products AS product + SELECT VALUE VarP(product.ListPrice) + FROM AdventureWorksEntities.Products AS product WHERE product.ListPrice > @price // */ - queryString = @"SELECT VALUE VarP(product.ListPrice) - FROM AdventureWorksEntities.Products AS product + queryString = @"SELECT VALUE VarP(product.ListPrice) + FROM AdventureWorksEntities.Products AS product WHERE product.ListPrice > @price"; pc.Add("price", 20); TestProduct(queryString, pc); @@ -735,38 +735,38 @@ FROM AdventureWorksEntities.Products AS product /* // - SELECT VALUE product FROM AdventureWorksEntities.Products AS product + SELECT VALUE product FROM AdventureWorksEntities.Products AS product WHERE CEILING(product.ListPrice) == FLOOR(product.ListPrice) // */ - queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products AS product + queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products AS product WHERE CEILING(product.ListPrice) == FLOOR(product.ListPrice)"; /* // - SELECT VALUE product FROM AdventureWorksEntities.Products AS product + SELECT VALUE product FROM AdventureWorksEntities.Products AS product WHERE FLOOR(product.ListPrice) == CEILING(product.ListPrice) // */ - queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products AS product + queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products AS product WHERE FLOOR(product.ListPrice) == CEILING(product.ListPrice)"; /* // - SELECT VALUE SqlServer.AVG(p.ListPrice) FROM - AdventureWorksEntities.Products as p + SELECT VALUE SqlServer.AVG(p.ListPrice) FROM + AdventureWorksEntities.Products as p // */ - queryString = @"SELECT VALUE SqlServer.AVG(p.ListPrice) FROM + queryString = @"SELECT VALUE SqlServer.AVG(p.ListPrice) FROM AdventureWorksEntities.Products as p "; /* // - SELECT VALUE SqlServer.Checksum_Agg(cast(product.ListPrice as Int32)) - FROM AdventureWorksEntities.Products AS product - WHERE product.ListPrice > cast(@price as Decimal) + SELECT VALUE SqlServer.Checksum_Agg(cast(product.ListPrice as Int32)) + FROM AdventureWorksEntities.Products AS product + WHERE product.ListPrice > cast(@price as Decimal) // */ - queryString = @"SELECT VALUE SqlServer.Checksum_Agg(cast(product.ListPrice as Int32)) - FROM AdventureWorksEntities.Products AS product + queryString = @"SELECT VALUE SqlServer.Checksum_Agg(cast(product.ListPrice as Int32)) + FROM AdventureWorksEntities.Products AS product WHERE product.ListPrice > cast(@price as Decimal) "; pc.Add("price", 20); TestProduct(queryString, pc); @@ -774,66 +774,66 @@ FROM AdventureWorksEntities.Products AS product /* // - ANYELEMENT(SELECT VALUE SqlServer.COUNT(product.ProductID) - FROM AdventureWorksEntities.Products AS product - WHERE SqlServer.CEILING(product.ListPrice) == - SqlServer.FLOOR(product.ListPrice)) + ANYELEMENT(SELECT VALUE SqlServer.COUNT(product.ProductID) + FROM AdventureWorksEntities.Products AS product + WHERE SqlServer.CEILING(product.ListPrice) == + SqlServer.FLOOR(product.ListPrice)) // */ - queryString = @"ANYELEMENT(SELECT VALUE SqlServer.COUNT(product.ProductID) - FROM AdventureWorksEntities.Products AS product - WHERE SqlServer.CEILING(product.ListPrice) == + queryString = @"ANYELEMENT(SELECT VALUE SqlServer.COUNT(product.ProductID) + FROM AdventureWorksEntities.Products AS product + WHERE SqlServer.CEILING(product.ListPrice) == SqlServer.FLOOR(product.ListPrice)) "; /* // - ANYELEMENT(SELECT VALUE SqlServer.COUNT_BIG(product.ProductID) - FROM AdventureWorksEntities.Products AS product - WHERE SqlServer.CEILING(product.ListPrice) == - SqlServer.FLOOR(product.ListPrice)) + ANYELEMENT(SELECT VALUE SqlServer.COUNT_BIG(product.ProductID) + FROM AdventureWorksEntities.Products AS product + WHERE SqlServer.CEILING(product.ListPrice) == + SqlServer.FLOOR(product.ListPrice)) // */ - queryString = @"ANYELEMENT(SELECT VALUE SqlServer.COUNT_BIG(product.ProductID) - FROM AdventureWorksEntities.Products AS product - WHERE SqlServer.CEILING(product.ListPrice) == + queryString = @"ANYELEMENT(SELECT VALUE SqlServer.COUNT_BIG(product.ProductID) + FROM AdventureWorksEntities.Products AS product + WHERE SqlServer.CEILING(product.ListPrice) == SqlServer.FLOOR(product.ListPrice)) "; /* // - SELECT VALUE SqlServer.MAX(p.ListPrice) + SELECT VALUE SqlServer.MAX(p.ListPrice) FROM AdventureWorksEntities.Products as p // */ - queryString = @"SELECT VALUE SqlServer.MAX(p.ListPrice) + queryString = @"SELECT VALUE SqlServer.MAX(p.ListPrice) FROM AdventureWorksEntities.Products as p"; /* // - SELECT VALUE SqlServer.MIN(p.ListPrice) + SELECT VALUE SqlServer.MIN(p.ListPrice) FROM AdventureWorksEntities.Products as p // */ - queryString = @"SELECT VALUE SqlServer.MIN(p.ListPrice) + queryString = @"SELECT VALUE SqlServer.MIN(p.ListPrice) FROM AdventureWorksEntities.Products as p"; /* // - SELECT VALUE SqlServer.STDEV(product.ListPrice) - FROM AdventureWorksEntities.Products AS product - WHERE product.ListPrice > cast(@price as Decimal) + SELECT VALUE SqlServer.STDEV(product.ListPrice) + FROM AdventureWorksEntities.Products AS product + WHERE product.ListPrice > cast(@price as Decimal) // */ - queryString = @"SELECT VALUE SqlServer.STDEV(product.ListPrice) - FROM AdventureWorksEntities.Products AS product + queryString = @"SELECT VALUE SqlServer.STDEV(product.ListPrice) + FROM AdventureWorksEntities.Products AS product WHERE product.ListPrice > cast(@price as Decimal) "; pc.Add("price", 20); TestProduct(queryString, pc); pc.Clear(); /* // - SELECT VALUE SqlServer.STDEVP(product.ListPrice) - FROM AdventureWorksEntities.Products AS product - WHERE product.ListPrice > cast(@price as Decimal) + SELECT VALUE SqlServer.STDEVP(product.ListPrice) + FROM AdventureWorksEntities.Products AS product + WHERE product.ListPrice > cast(@price as Decimal) // */ - queryString = @"SELECT VALUE SqlServer.STDEVP(product.ListPrice) - FROM AdventureWorksEntities.Products AS product + queryString = @"SELECT VALUE SqlServer.STDEVP(product.ListPrice) + FROM AdventureWorksEntities.Products AS product WHERE product.ListPrice > cast(@price as Decimal) "; pc.Add("price", 20); TestProduct(queryString, pc); @@ -841,21 +841,21 @@ FROM AdventureWorksEntities.Products AS product /* // - SELECT VALUE SqlServer.SUM(p.ListPrice) + SELECT VALUE SqlServer.SUM(p.ListPrice) FROM AdventureWorksEntities.Products as p // */ - queryString = @"SELECT VALUE SqlServer.SUM(p.ListPrice) + queryString = @"SELECT VALUE SqlServer.SUM(p.ListPrice) FROM AdventureWorksEntities.Products as p"; /* // - SELECT VALUE SqlServer.VAR(product.ListPrice) - FROM AdventureWorksEntities.Products AS product - WHERE product.ListPrice > cast(@price as Decimal) + SELECT VALUE SqlServer.VAR(product.ListPrice) + FROM AdventureWorksEntities.Products AS product + WHERE product.ListPrice > cast(@price as Decimal) // */ - queryString = @"SELECT VALUE SqlServer.VAR(product.ListPrice) - FROM AdventureWorksEntities.Products AS product + queryString = @"SELECT VALUE SqlServer.VAR(product.ListPrice) + FROM AdventureWorksEntities.Products AS product WHERE product.ListPrice > cast(@price as Decimal)"; pc.Add("price", 20); TestProduct(queryString, pc); @@ -863,36 +863,36 @@ FROM AdventureWorksEntities.Products AS product /* // - SELECT VALUE SqlServer.VARP(product.ListPrice) - FROM AdventureWorksEntities.Products AS product - WHERE product.ListPrice > cast(@price as Decimal) + SELECT VALUE SqlServer.VARP(product.ListPrice) + FROM AdventureWorksEntities.Products AS product + WHERE product.ListPrice > cast(@price as Decimal) // */ - queryString = @"SELECT VALUE SqlServer.VARP(product.ListPrice) - FROM AdventureWorksEntities.Products AS product + queryString = @"SELECT VALUE SqlServer.VARP(product.ListPrice) + FROM AdventureWorksEntities.Products AS product WHERE product.ListPrice > cast(@price as Decimal) "; pc.Add("price", 20); TestProduct(queryString, pc); pc.Clear(); /* // - SELECT VALUE product FROM AdventureWorksEntities.Products - AS product WHERE product.ListPrice == - SqlServer.CEILING(product.ListPrice) + SELECT VALUE product FROM AdventureWorksEntities.Products + AS product WHERE product.ListPrice == + SqlServer.CEILING(product.ListPrice) // */ - queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products - AS product WHERE product.ListPrice == + queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products + AS product WHERE product.ListPrice == SqlServer.CEILING(product.ListPrice) "; /* // - SELECT VALUE product FROM AdventureWorksEntities.Products - AS product WHERE product.ListPrice == - SqlServer.FLOOR(product.ListPrice) + SELECT VALUE product FROM AdventureWorksEntities.Products + AS product WHERE product.ListPrice == + SqlServer.FLOOR(product.ListPrice) // */ - queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products - AS product WHERE product.ListPrice == + queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products + AS product WHERE product.ListPrice == SqlServer.FLOOR(product.ListPrice) "; /* // @@ -901,8 +901,8 @@ Function MyAvg(dues Collection(Decimal)) AS ( Avg(select value due from dues as due where due > @price) ) - SELECT TOP(10) contactID, MyAvg(GroupPartition(order.TotalDue)) - FROM AdventureWorksEntities.SalesOrderHeaders AS order + SELECT TOP(10) contactID, MyAvg(GroupPartition(order.TotalDue)) + FROM AdventureWorksEntities.SalesOrderHeaders AS order GROUP BY order.Contact.ContactID as contactID; // */ @@ -911,8 +911,8 @@ Function MyAvg(dues Collection(Decimal)) AS ( Avg(SELECT VALUE due FROM dues as due WHERE due > @price) ) - SELECT TOP(10) contactID, MyAvg(GroupPartition(order.TotalDue)) - FROM AdventureWorksEntities.SalesOrderHeaders + SELECT TOP(10) contactID, MyAvg(GroupPartition(order.TotalDue)) + FROM AdventureWorksEntities.SalesOrderHeaders AS order GROUP BY order.Contact.ContactID as contactID; "; pc.Add("price", 20); @@ -942,7 +942,7 @@ static void TestProduct(string esqlQuery, Dictionary parametes) using (EntityDataReader rdr = cmd.ExecuteReader(CommandBehavior.SequentialAccess)) { - // The result returned by this query contains + // The result returned by this query contains // Address complex Types. while (rdr.Read()) { diff --git a/samples/snippets/csharp/VS_Snippets_Data/dp entityservices concepts/cs/adventureworks.designer.cs b/samples/snippets/csharp/VS_Snippets_Data/dp entityservices concepts/cs/adventureworks.designer.cs index 36212afd3435f..152bcb607adcf 100644 --- a/samples/snippets/csharp/VS_Snippets_Data/dp entityservices concepts/cs/adventureworks.designer.cs +++ b/samples/snippets/csharp/VS_Snippets_Data/dp entityservices concepts/cs/adventureworks.designer.cs @@ -40,7 +40,7 @@ public AdventureWorksEntities() : base("name=AdventureWorksEntities", "Adventure { OnContextCreated(); } - + /// /// Initialize a new AdventureWorksEntities object. /// @@ -48,7 +48,7 @@ public AdventureWorksEntities(string connectionString) : base(connectionString, { OnContextCreated(); } - + /// /// Initialize a new AdventureWorksEntities object. /// @@ -57,11 +57,11 @@ public AdventureWorksEntities(EntityConnection connection) : base(connection, "A OnContextCreated(); } #endregion - + #region Partial Methods partial void OnContextCreated(); #endregion - + #region ObjectSet Properties /// /// No Metadata Documentation available. @@ -78,7 +78,7 @@ public ObjectSet
Address } } private ObjectSet
_Address; - + /// /// No Metadata Documentation available. /// @@ -94,7 +94,7 @@ public ObjectSet Contact } } private ObjectSet _Contact; - + /// /// No Metadata Documentation available. /// @@ -110,7 +110,7 @@ public ObjectSet Product } } private ObjectSet _Product; - + /// /// No Metadata Documentation available. /// @@ -126,7 +126,7 @@ public ObjectSet SalesOrderDetail } } private ObjectSet _SalesOrderDetail; - + /// /// No Metadata Documentation available. /// @@ -142,10 +142,10 @@ public ObjectSet SalesOrderHeader } } private ObjectSet _SalesOrderHeader; - + #endregion #region AddTo Methods - + /// /// Deprecated Method for adding a new object to the Address EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// @@ -153,7 +153,7 @@ public void AddToAddress(Address address) { base.AddObject("Address", address); } - + /// /// Deprecated Method for adding a new object to the Contact EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// @@ -161,7 +161,7 @@ public void AddToContact(Contact contact) { base.AddObject("Contact", contact); } - + /// /// Deprecated Method for adding a new object to the Product EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// @@ -169,7 +169,7 @@ public void AddToProduct(Product product) { base.AddObject("Product", product); } - + /// /// Deprecated Method for adding a new object to the SalesOrderDetail EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// @@ -177,7 +177,7 @@ public void AddToSalesOrderDetail(SalesOrderDetail salesOrderDetail) { base.AddObject("SalesOrderDetail", salesOrderDetail); } - + /// /// Deprecated Method for adding a new object to the SalesOrderHeader EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// @@ -187,10 +187,10 @@ public void AddToSalesOrderHeader(SalesOrderHeader salesOrderHeader) } #endregion } - + #endregion - - + + #region Entities /// /// No Metadata Documentation available. @@ -215,19 +215,19 @@ public static Address CreateAddress(global::System.Int32 addressID, global::Syst { Address address = new Address(); address.AddressID = addressID; - + address.AddressLine1 = addressLine1; - + address.City = city; - + address.StateProvinceID = stateProvinceID; - + address.PostalCode = postalCode; - + address.rowguid = rowguid; - + address.ModifiedDate = modifiedDate; - + return address; } #endregion @@ -252,12 +252,12 @@ public static Address CreateAddress(global::System.Int32 addressID, global::Syst ReportPropertyChanged("AddressID"); OnAddressIDChanged(); } - + } private global::System.Int32 _AddressID; partial void OnAddressIDChanging(global::System.Int32 value); partial void OnAddressIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -277,12 +277,12 @@ public static Address CreateAddress(global::System.Int32 addressID, global::Syst ReportPropertyChanged("AddressLine1"); OnAddressLine1Changed(); } - + } private global::System.String _AddressLine1; partial void OnAddressLine1Changing(global::System.String value); partial void OnAddressLine1Changed(); - + /// /// No Metadata Documentation available. /// @@ -302,12 +302,12 @@ public static Address CreateAddress(global::System.Int32 addressID, global::Syst ReportPropertyChanged("AddressLine2"); OnAddressLine2Changed(); } - + } private global::System.String _AddressLine2; partial void OnAddressLine2Changing(global::System.String value); partial void OnAddressLine2Changed(); - + /// /// No Metadata Documentation available. /// @@ -327,12 +327,12 @@ public static Address CreateAddress(global::System.Int32 addressID, global::Syst ReportPropertyChanged("City"); OnCityChanged(); } - + } private global::System.String _City; partial void OnCityChanging(global::System.String value); partial void OnCityChanged(); - + /// /// No Metadata Documentation available. /// @@ -352,12 +352,12 @@ public static Address CreateAddress(global::System.Int32 addressID, global::Syst ReportPropertyChanged("StateProvinceID"); OnStateProvinceIDChanged(); } - + } private global::System.Int32 _StateProvinceID; partial void OnStateProvinceIDChanging(global::System.Int32 value); partial void OnStateProvinceIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -377,12 +377,12 @@ public static Address CreateAddress(global::System.Int32 addressID, global::Syst ReportPropertyChanged("PostalCode"); OnPostalCodeChanged(); } - + } private global::System.String _PostalCode; partial void OnPostalCodeChanging(global::System.String value); partial void OnPostalCodeChanged(); - + /// /// No Metadata Documentation available. /// @@ -402,12 +402,12 @@ public static Address CreateAddress(global::System.Int32 addressID, global::Syst ReportPropertyChanged("rowguid"); OnrowguidChanged(); } - + } private global::System.Guid _rowguid; partial void OnrowguidChanging(global::System.Guid value); partial void OnrowguidChanged(); - + /// /// No Metadata Documentation available. /// @@ -427,14 +427,14 @@ public static Address CreateAddress(global::System.Int32 addressID, global::Syst ReportPropertyChanged("ModifiedDate"); OnModifiedDateChanged(); } - + } private global::System.DateTime _ModifiedDate; partial void OnModifiedDateChanging(global::System.DateTime value); partial void OnModifiedDateChanged(); - + #endregion - + #region Navigation Properties /// /// No Metadata Documentation available. @@ -442,7 +442,7 @@ public static Address CreateAddress(global::System.Int32 addressID, global::Syst [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Address_BillToAddressID", "SalesOrderHeader")] + [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Address_BillToAddressID", "SalesOrderHeader")] public EntityCollection SalesOrderHeader { get @@ -463,7 +463,7 @@ public EntityCollection SalesOrderHeader [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Address_ShipToAddressID", "SalesOrderHeader")] + [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Address_ShipToAddressID", "SalesOrderHeader")] public EntityCollection SalesOrderHeader1 { get @@ -480,7 +480,7 @@ public EntityCollection SalesOrderHeader1 } #endregion } - + /// /// No Metadata Documentation available. /// @@ -506,23 +506,23 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst { Contact contact = new Contact(); contact.ContactID = contactID; - + contact.NameStyle = nameStyle; - + contact.FirstName = firstName; - + contact.LastName = lastName; - + contact.EmailPromotion = emailPromotion; - + contact.PasswordHash = passwordHash; - + contact.PasswordSalt = passwordSalt; - + contact.rowguid = rowguid; - + contact.ModifiedDate = modifiedDate; - + return contact; } #endregion @@ -547,12 +547,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("ContactID"); OnContactIDChanged(); } - + } private global::System.Int32 _ContactID; partial void OnContactIDChanging(global::System.Int32 value); partial void OnContactIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -572,12 +572,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("NameStyle"); OnNameStyleChanged(); } - + } private global::System.Boolean _NameStyle; partial void OnNameStyleChanging(global::System.Boolean value); partial void OnNameStyleChanged(); - + /// /// No Metadata Documentation available. /// @@ -597,12 +597,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("Title"); OnTitleChanged(); } - + } private global::System.String _Title; partial void OnTitleChanging(global::System.String value); partial void OnTitleChanged(); - + /// /// No Metadata Documentation available. /// @@ -622,12 +622,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("FirstName"); OnFirstNameChanged(); } - + } private global::System.String _FirstName; partial void OnFirstNameChanging(global::System.String value); partial void OnFirstNameChanged(); - + /// /// No Metadata Documentation available. /// @@ -647,12 +647,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("MiddleName"); OnMiddleNameChanged(); } - + } private global::System.String _MiddleName; partial void OnMiddleNameChanging(global::System.String value); partial void OnMiddleNameChanged(); - + /// /// No Metadata Documentation available. /// @@ -672,12 +672,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("LastName"); OnLastNameChanged(); } - + } private global::System.String _LastName; partial void OnLastNameChanging(global::System.String value); partial void OnLastNameChanged(); - + /// /// No Metadata Documentation available. /// @@ -697,12 +697,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("Suffix"); OnSuffixChanged(); } - + } private global::System.String _Suffix; partial void OnSuffixChanging(global::System.String value); partial void OnSuffixChanged(); - + /// /// No Metadata Documentation available. /// @@ -722,12 +722,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("EmailAddress"); OnEmailAddressChanged(); } - + } private global::System.String _EmailAddress; partial void OnEmailAddressChanging(global::System.String value); partial void OnEmailAddressChanged(); - + /// /// No Metadata Documentation available. /// @@ -747,12 +747,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("EmailPromotion"); OnEmailPromotionChanged(); } - + } private global::System.Int32 _EmailPromotion; partial void OnEmailPromotionChanging(global::System.Int32 value); partial void OnEmailPromotionChanged(); - + /// /// No Metadata Documentation available. /// @@ -772,12 +772,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("Phone"); OnPhoneChanged(); } - + } private global::System.String _Phone; partial void OnPhoneChanging(global::System.String value); partial void OnPhoneChanged(); - + /// /// No Metadata Documentation available. /// @@ -797,12 +797,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("PasswordHash"); OnPasswordHashChanged(); } - + } private global::System.String _PasswordHash; partial void OnPasswordHashChanging(global::System.String value); partial void OnPasswordHashChanged(); - + /// /// No Metadata Documentation available. /// @@ -822,12 +822,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("PasswordSalt"); OnPasswordSaltChanged(); } - + } private global::System.String _PasswordSalt; partial void OnPasswordSaltChanging(global::System.String value); partial void OnPasswordSaltChanged(); - + /// /// No Metadata Documentation available. /// @@ -847,12 +847,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("AdditionalContactInfo"); OnAdditionalContactInfoChanged(); } - + } private global::System.String _AdditionalContactInfo; partial void OnAdditionalContactInfoChanging(global::System.String value); partial void OnAdditionalContactInfoChanged(); - + /// /// No Metadata Documentation available. /// @@ -872,12 +872,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("rowguid"); OnrowguidChanged(); } - + } private global::System.Guid _rowguid; partial void OnrowguidChanging(global::System.Guid value); partial void OnrowguidChanged(); - + /// /// No Metadata Documentation available. /// @@ -897,14 +897,14 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("ModifiedDate"); OnModifiedDateChanged(); } - + } private global::System.DateTime _ModifiedDate; partial void OnModifiedDateChanging(global::System.DateTime value); partial void OnModifiedDateChanged(); - + #endregion - + #region Navigation Properties /// /// No Metadata Documentation available. @@ -912,7 +912,7 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Contact_ContactID", "SalesOrderHeader")] + [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Contact_ContactID", "SalesOrderHeader")] public EntityCollection SalesOrderHeader { get @@ -929,7 +929,7 @@ public EntityCollection SalesOrderHeader } #endregion } - + /// /// No Metadata Documentation available. /// @@ -959,31 +959,31 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst { Product product = new Product(); product.ProductID = productID; - + product.Name = name; - + product.ProductNumber = productNumber; - + product.MakeFlag = makeFlag; - + product.FinishedGoodsFlag = finishedGoodsFlag; - + product.SafetyStockLevel = safetyStockLevel; - + product.ReorderPoint = reorderPoint; - + product.StandardCost = standardCost; - + product.ListPrice = listPrice; - + product.DaysToManufacture = daysToManufacture; - + product.SellStartDate = sellStartDate; - + product.rowguid = rowguid; - + product.ModifiedDate = modifiedDate; - + return product; } #endregion @@ -1008,12 +1008,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("ProductID"); OnProductIDChanged(); } - + } private global::System.Int32 _ProductID; partial void OnProductIDChanging(global::System.Int32 value); partial void OnProductIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1033,12 +1033,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("Name"); OnNameChanged(); } - + } private global::System.String _Name; partial void OnNameChanging(global::System.String value); partial void OnNameChanged(); - + /// /// No Metadata Documentation available. /// @@ -1058,12 +1058,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("ProductNumber"); OnProductNumberChanged(); } - + } private global::System.String _ProductNumber; partial void OnProductNumberChanging(global::System.String value); partial void OnProductNumberChanged(); - + /// /// No Metadata Documentation available. /// @@ -1083,12 +1083,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("MakeFlag"); OnMakeFlagChanged(); } - + } private global::System.Boolean _MakeFlag; partial void OnMakeFlagChanging(global::System.Boolean value); partial void OnMakeFlagChanged(); - + /// /// No Metadata Documentation available. /// @@ -1108,12 +1108,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("FinishedGoodsFlag"); OnFinishedGoodsFlagChanged(); } - + } private global::System.Boolean _FinishedGoodsFlag; partial void OnFinishedGoodsFlagChanging(global::System.Boolean value); partial void OnFinishedGoodsFlagChanged(); - + /// /// No Metadata Documentation available. /// @@ -1133,12 +1133,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("Color"); OnColorChanged(); } - + } private global::System.String _Color; partial void OnColorChanging(global::System.String value); partial void OnColorChanged(); - + /// /// No Metadata Documentation available. /// @@ -1158,12 +1158,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("SafetyStockLevel"); OnSafetyStockLevelChanged(); } - + } private global::System.Int16 _SafetyStockLevel; partial void OnSafetyStockLevelChanging(global::System.Int16 value); partial void OnSafetyStockLevelChanged(); - + /// /// No Metadata Documentation available. /// @@ -1183,12 +1183,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("ReorderPoint"); OnReorderPointChanged(); } - + } private global::System.Int16 _ReorderPoint; partial void OnReorderPointChanging(global::System.Int16 value); partial void OnReorderPointChanged(); - + /// /// No Metadata Documentation available. /// @@ -1208,12 +1208,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("StandardCost"); OnStandardCostChanged(); } - + } private global::System.Decimal _StandardCost; partial void OnStandardCostChanging(global::System.Decimal value); partial void OnStandardCostChanged(); - + /// /// No Metadata Documentation available. /// @@ -1233,12 +1233,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("ListPrice"); OnListPriceChanged(); } - + } private global::System.Decimal _ListPrice; partial void OnListPriceChanging(global::System.Decimal value); partial void OnListPriceChanged(); - + /// /// No Metadata Documentation available. /// @@ -1258,12 +1258,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("Size"); OnSizeChanged(); } - + } private global::System.String _Size; partial void OnSizeChanging(global::System.String value); partial void OnSizeChanged(); - + /// /// No Metadata Documentation available. /// @@ -1283,12 +1283,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("SizeUnitMeasureCode"); OnSizeUnitMeasureCodeChanged(); } - + } private global::System.String _SizeUnitMeasureCode; partial void OnSizeUnitMeasureCodeChanging(global::System.String value); partial void OnSizeUnitMeasureCodeChanged(); - + /// /// No Metadata Documentation available. /// @@ -1308,12 +1308,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("WeightUnitMeasureCode"); OnWeightUnitMeasureCodeChanged(); } - + } private global::System.String _WeightUnitMeasureCode; partial void OnWeightUnitMeasureCodeChanging(global::System.String value); partial void OnWeightUnitMeasureCodeChanged(); - + /// /// No Metadata Documentation available. /// @@ -1333,12 +1333,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("Weight"); OnWeightChanged(); } - + } private Nullable _Weight; partial void OnWeightChanging(Nullable value); partial void OnWeightChanged(); - + /// /// No Metadata Documentation available. /// @@ -1358,12 +1358,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("DaysToManufacture"); OnDaysToManufactureChanged(); } - + } private global::System.Int32 _DaysToManufacture; partial void OnDaysToManufactureChanging(global::System.Int32 value); partial void OnDaysToManufactureChanged(); - + /// /// No Metadata Documentation available. /// @@ -1383,12 +1383,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("ProductLine"); OnProductLineChanged(); } - + } private global::System.String _ProductLine; partial void OnProductLineChanging(global::System.String value); partial void OnProductLineChanged(); - + /// /// No Metadata Documentation available. /// @@ -1408,12 +1408,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("Class"); OnClassChanged(); } - + } private global::System.String _Class; partial void OnClassChanging(global::System.String value); partial void OnClassChanged(); - + /// /// No Metadata Documentation available. /// @@ -1433,12 +1433,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("Style"); OnStyleChanged(); } - + } private global::System.String _Style; partial void OnStyleChanging(global::System.String value); partial void OnStyleChanged(); - + /// /// No Metadata Documentation available. /// @@ -1458,12 +1458,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("ProductSubcategoryID"); OnProductSubcategoryIDChanged(); } - + } private Nullable _ProductSubcategoryID; partial void OnProductSubcategoryIDChanging(Nullable value); partial void OnProductSubcategoryIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1483,12 +1483,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("ProductModelID"); OnProductModelIDChanged(); } - + } private Nullable _ProductModelID; partial void OnProductModelIDChanging(Nullable value); partial void OnProductModelIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1508,12 +1508,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("SellStartDate"); OnSellStartDateChanged(); } - + } private global::System.DateTime _SellStartDate; partial void OnSellStartDateChanging(global::System.DateTime value); partial void OnSellStartDateChanged(); - + /// /// No Metadata Documentation available. /// @@ -1533,12 +1533,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("SellEndDate"); OnSellEndDateChanged(); } - + } private Nullable _SellEndDate; partial void OnSellEndDateChanging(Nullable value); partial void OnSellEndDateChanged(); - + /// /// No Metadata Documentation available. /// @@ -1558,12 +1558,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("DiscontinuedDate"); OnDiscontinuedDateChanged(); } - + } private Nullable _DiscontinuedDate; partial void OnDiscontinuedDateChanging(Nullable value); partial void OnDiscontinuedDateChanged(); - + /// /// No Metadata Documentation available. /// @@ -1583,12 +1583,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("rowguid"); OnrowguidChanged(); } - + } private global::System.Guid _rowguid; partial void OnrowguidChanging(global::System.Guid value); partial void OnrowguidChanged(); - + /// /// No Metadata Documentation available. /// @@ -1608,16 +1608,16 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("ModifiedDate"); OnModifiedDateChanged(); } - + } private global::System.DateTime _ModifiedDate; partial void OnModifiedDateChanging(global::System.DateTime value); partial void OnModifiedDateChanged(); - + #endregion - + } - + /// /// No Metadata Documentation available. /// @@ -1644,25 +1644,25 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales { SalesOrderDetail salesOrderDetail = new SalesOrderDetail(); salesOrderDetail.SalesOrderID = salesOrderID; - + salesOrderDetail.SalesOrderDetailID = salesOrderDetailID; - + salesOrderDetail.OrderQty = orderQty; - + salesOrderDetail.ProductID = productID; - + salesOrderDetail.SpecialOfferID = specialOfferID; - + salesOrderDetail.UnitPrice = unitPrice; - + salesOrderDetail.UnitPriceDiscount = unitPriceDiscount; - + salesOrderDetail.LineTotal = lineTotal; - + salesOrderDetail.rowguid = rowguid; - + salesOrderDetail.ModifiedDate = modifiedDate; - + return salesOrderDetail; } #endregion @@ -1687,12 +1687,12 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales ReportPropertyChanged("SalesOrderID"); OnSalesOrderIDChanged(); } - + } private global::System.Int32 _SalesOrderID; partial void OnSalesOrderIDChanging(global::System.Int32 value); partial void OnSalesOrderIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1712,12 +1712,12 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales ReportPropertyChanged("SalesOrderDetailID"); OnSalesOrderDetailIDChanged(); } - + } private global::System.Int32 _SalesOrderDetailID; partial void OnSalesOrderDetailIDChanging(global::System.Int32 value); partial void OnSalesOrderDetailIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1737,12 +1737,12 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales ReportPropertyChanged("CarrierTrackingNumber"); OnCarrierTrackingNumberChanged(); } - + } private global::System.String _CarrierTrackingNumber; partial void OnCarrierTrackingNumberChanging(global::System.String value); partial void OnCarrierTrackingNumberChanged(); - + /// /// No Metadata Documentation available. /// @@ -1762,12 +1762,12 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales ReportPropertyChanged("OrderQty"); OnOrderQtyChanged(); } - + } private global::System.Int16 _OrderQty; partial void OnOrderQtyChanging(global::System.Int16 value); partial void OnOrderQtyChanged(); - + /// /// No Metadata Documentation available. /// @@ -1787,12 +1787,12 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales ReportPropertyChanged("ProductID"); OnProductIDChanged(); } - + } private global::System.Int32 _ProductID; partial void OnProductIDChanging(global::System.Int32 value); partial void OnProductIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1812,12 +1812,12 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales ReportPropertyChanged("SpecialOfferID"); OnSpecialOfferIDChanged(); } - + } private global::System.Int32 _SpecialOfferID; partial void OnSpecialOfferIDChanging(global::System.Int32 value); partial void OnSpecialOfferIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1837,12 +1837,12 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales ReportPropertyChanged("UnitPrice"); OnUnitPriceChanged(); } - + } private global::System.Decimal _UnitPrice; partial void OnUnitPriceChanging(global::System.Decimal value); partial void OnUnitPriceChanged(); - + /// /// No Metadata Documentation available. /// @@ -1862,12 +1862,12 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales ReportPropertyChanged("UnitPriceDiscount"); OnUnitPriceDiscountChanged(); } - + } private global::System.Decimal _UnitPriceDiscount; partial void OnUnitPriceDiscountChanging(global::System.Decimal value); partial void OnUnitPriceDiscountChanged(); - + /// /// No Metadata Documentation available. /// @@ -1887,12 +1887,12 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales ReportPropertyChanged("LineTotal"); OnLineTotalChanged(); } - + } private global::System.Decimal _LineTotal; partial void OnLineTotalChanging(global::System.Decimal value); partial void OnLineTotalChanged(); - + /// /// No Metadata Documentation available. /// @@ -1912,12 +1912,12 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales ReportPropertyChanged("rowguid"); OnrowguidChanged(); } - + } private global::System.Guid _rowguid; partial void OnrowguidChanging(global::System.Guid value); partial void OnrowguidChanged(); - + /// /// No Metadata Documentation available. /// @@ -1937,14 +1937,14 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales ReportPropertyChanged("ModifiedDate"); OnModifiedDateChanged(); } - + } private global::System.DateTime _ModifiedDate; partial void OnModifiedDateChanging(global::System.DateTime value); partial void OnModifiedDateChanged(); - + #endregion - + #region Navigation Properties /// /// No Metadata Documentation available. @@ -1952,7 +1952,7 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderDetail_SalesOrderHeader_SalesOrderID", "SalesOrderHeader")] + [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderDetail_SalesOrderHeader_SalesOrderID", "SalesOrderHeader")] public SalesOrderHeader SalesOrderHeader { get @@ -1985,7 +1985,7 @@ public EntityReference SalesOrderHeaderReference } #endregion } - + /// /// No Metadata Documentation available. /// @@ -2017,35 +2017,35 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales { SalesOrderHeader salesOrderHeader = new SalesOrderHeader(); salesOrderHeader.SalesOrderID = salesOrderID; - + salesOrderHeader.RevisionNumber = revisionNumber; - + salesOrderHeader.OrderDate = orderDate; - + salesOrderHeader.DueDate = dueDate; - + salesOrderHeader.Status = status; - + salesOrderHeader.OnlineOrderFlag = onlineOrderFlag; - + salesOrderHeader.SalesOrderNumber = salesOrderNumber; - + salesOrderHeader.CustomerID = customerID; - + salesOrderHeader.ShipMethodID = shipMethodID; - + salesOrderHeader.SubTotal = subTotal; - + salesOrderHeader.TaxAmt = taxAmt; - + salesOrderHeader.Freight = freight; - + salesOrderHeader.TotalDue = totalDue; - + salesOrderHeader.rowguid = rowguid; - + salesOrderHeader.ModifiedDate = modifiedDate; - + return salesOrderHeader; } #endregion @@ -2070,12 +2070,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("SalesOrderID"); OnSalesOrderIDChanged(); } - + } private global::System.Int32 _SalesOrderID; partial void OnSalesOrderIDChanging(global::System.Int32 value); partial void OnSalesOrderIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2095,12 +2095,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("RevisionNumber"); OnRevisionNumberChanged(); } - + } private global::System.Byte _RevisionNumber; partial void OnRevisionNumberChanging(global::System.Byte value); partial void OnRevisionNumberChanged(); - + /// /// No Metadata Documentation available. /// @@ -2120,12 +2120,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("OrderDate"); OnOrderDateChanged(); } - + } private global::System.DateTime _OrderDate; partial void OnOrderDateChanging(global::System.DateTime value); partial void OnOrderDateChanged(); - + /// /// No Metadata Documentation available. /// @@ -2145,12 +2145,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("DueDate"); OnDueDateChanged(); } - + } private global::System.DateTime _DueDate; partial void OnDueDateChanging(global::System.DateTime value); partial void OnDueDateChanged(); - + /// /// No Metadata Documentation available. /// @@ -2170,12 +2170,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("ShipDate"); OnShipDateChanged(); } - + } private Nullable _ShipDate; partial void OnShipDateChanging(Nullable value); partial void OnShipDateChanged(); - + /// /// No Metadata Documentation available. /// @@ -2195,12 +2195,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("Status"); OnStatusChanged(); } - + } private global::System.Byte _Status; partial void OnStatusChanging(global::System.Byte value); partial void OnStatusChanged(); - + /// /// No Metadata Documentation available. /// @@ -2220,12 +2220,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("OnlineOrderFlag"); OnOnlineOrderFlagChanged(); } - + } private global::System.Boolean _OnlineOrderFlag; partial void OnOnlineOrderFlagChanging(global::System.Boolean value); partial void OnOnlineOrderFlagChanged(); - + /// /// No Metadata Documentation available. /// @@ -2245,12 +2245,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("SalesOrderNumber"); OnSalesOrderNumberChanged(); } - + } private global::System.String _SalesOrderNumber; partial void OnSalesOrderNumberChanging(global::System.String value); partial void OnSalesOrderNumberChanged(); - + /// /// No Metadata Documentation available. /// @@ -2270,12 +2270,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("PurchaseOrderNumber"); OnPurchaseOrderNumberChanged(); } - + } private global::System.String _PurchaseOrderNumber; partial void OnPurchaseOrderNumberChanging(global::System.String value); partial void OnPurchaseOrderNumberChanged(); - + /// /// No Metadata Documentation available. /// @@ -2295,12 +2295,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("AccountNumber"); OnAccountNumberChanged(); } - + } private global::System.String _AccountNumber; partial void OnAccountNumberChanging(global::System.String value); partial void OnAccountNumberChanged(); - + /// /// No Metadata Documentation available. /// @@ -2320,12 +2320,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("CustomerID"); OnCustomerIDChanged(); } - + } private global::System.Int32 _CustomerID; partial void OnCustomerIDChanging(global::System.Int32 value); partial void OnCustomerIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2345,12 +2345,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("SalesPersonID"); OnSalesPersonIDChanged(); } - + } private Nullable _SalesPersonID; partial void OnSalesPersonIDChanging(Nullable value); partial void OnSalesPersonIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2370,12 +2370,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("TerritoryID"); OnTerritoryIDChanged(); } - + } private Nullable _TerritoryID; partial void OnTerritoryIDChanging(Nullable value); partial void OnTerritoryIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2395,12 +2395,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("ShipMethodID"); OnShipMethodIDChanged(); } - + } private global::System.Int32 _ShipMethodID; partial void OnShipMethodIDChanging(global::System.Int32 value); partial void OnShipMethodIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2420,12 +2420,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("CreditCardID"); OnCreditCardIDChanged(); } - + } private Nullable _CreditCardID; partial void OnCreditCardIDChanging(Nullable value); partial void OnCreditCardIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2445,12 +2445,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("CreditCardApprovalCode"); OnCreditCardApprovalCodeChanged(); } - + } private global::System.String _CreditCardApprovalCode; partial void OnCreditCardApprovalCodeChanging(global::System.String value); partial void OnCreditCardApprovalCodeChanged(); - + /// /// No Metadata Documentation available. /// @@ -2470,12 +2470,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("CurrencyRateID"); OnCurrencyRateIDChanged(); } - + } private Nullable _CurrencyRateID; partial void OnCurrencyRateIDChanging(Nullable value); partial void OnCurrencyRateIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2495,12 +2495,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("SubTotal"); OnSubTotalChanged(); } - + } private global::System.Decimal _SubTotal; partial void OnSubTotalChanging(global::System.Decimal value); partial void OnSubTotalChanged(); - + /// /// No Metadata Documentation available. /// @@ -2520,12 +2520,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("TaxAmt"); OnTaxAmtChanged(); } - + } private global::System.Decimal _TaxAmt; partial void OnTaxAmtChanging(global::System.Decimal value); partial void OnTaxAmtChanged(); - + /// /// No Metadata Documentation available. /// @@ -2545,12 +2545,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("Freight"); OnFreightChanged(); } - + } private global::System.Decimal _Freight; partial void OnFreightChanging(global::System.Decimal value); partial void OnFreightChanged(); - + /// /// No Metadata Documentation available. /// @@ -2570,12 +2570,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("TotalDue"); OnTotalDueChanged(); } - + } private global::System.Decimal _TotalDue; partial void OnTotalDueChanging(global::System.Decimal value); partial void OnTotalDueChanged(); - + /// /// No Metadata Documentation available. /// @@ -2595,12 +2595,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("Comment"); OnCommentChanged(); } - + } private global::System.String _Comment; partial void OnCommentChanging(global::System.String value); partial void OnCommentChanged(); - + /// /// No Metadata Documentation available. /// @@ -2620,12 +2620,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("rowguid"); OnrowguidChanged(); } - + } private global::System.Guid _rowguid; partial void OnrowguidChanging(global::System.Guid value); partial void OnrowguidChanged(); - + /// /// No Metadata Documentation available. /// @@ -2645,14 +2645,14 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("ModifiedDate"); OnModifiedDateChanged(); } - + } private global::System.DateTime _ModifiedDate; partial void OnModifiedDateChanging(global::System.DateTime value); partial void OnModifiedDateChanged(); - + #endregion - + #region Navigation Properties /// /// No Metadata Documentation available. @@ -2660,7 +2660,7 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Address_BillToAddressID", "Address")] + [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Address_BillToAddressID", "Address")] public Address Address { get @@ -2697,7 +2697,7 @@ public EntityReference
AddressReference [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Address_ShipToAddressID", "Address")] + [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Address_ShipToAddressID", "Address")] public Address Address1 { get @@ -2734,7 +2734,7 @@ public EntityReference
Address1Reference [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Contact_ContactID", "Contact")] + [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Contact_ContactID", "Contact")] public Contact Contact { get @@ -2771,7 +2771,7 @@ public EntityReference ContactReference [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderDetail_SalesOrderHeader_SalesOrderID", "SalesOrderDetail")] + [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderDetail_SalesOrderHeader_SalesOrderID", "SalesOrderDetail")] public EntityCollection SalesOrderDetail { get @@ -2788,7 +2788,7 @@ public EntityCollection SalesOrderDetail } #endregion } - + #endregion - + } diff --git a/samples/snippets/csharp/VS_Snippets_Data/dp entityservices concepts/cs/adventureworksmodel.designer.cs b/samples/snippets/csharp/VS_Snippets_Data/dp entityservices concepts/cs/adventureworksmodel.designer.cs index 2e23fe98f9730..f457d518c31da 100644 --- a/samples/snippets/csharp/VS_Snippets_Data/dp entityservices concepts/cs/adventureworksmodel.designer.cs +++ b/samples/snippets/csharp/VS_Snippets_Data/dp entityservices concepts/cs/adventureworksmodel.designer.cs @@ -28,14 +28,14 @@ namespace Microsoft.Samples.Entity { #region Contexts - + /// /// No Metadata Documentation available. /// public partial class AdventureWorksEntities : ObjectContext { #region Constructors - + /// /// Initializes a new AdventureWorksEntities object using the connection string found in the 'AdventureWorksEntities' section of the application configuration file. /// @@ -44,7 +44,7 @@ public AdventureWorksEntities() : base("name=AdventureWorksEntities", "Adventure this.ContextOptions.LazyLoadingEnabled = true; OnContextCreated(); } - + /// /// Initialize a new AdventureWorksEntities object. /// @@ -53,7 +53,7 @@ public AdventureWorksEntities(string connectionString) : base(connectionString, this.ContextOptions.LazyLoadingEnabled = true; OnContextCreated(); } - + /// /// Initialize a new AdventureWorksEntities object. /// @@ -62,17 +62,17 @@ public AdventureWorksEntities(EntityConnection connection) : base(connection, "A this.ContextOptions.LazyLoadingEnabled = true; OnContextCreated(); } - + #endregion - + #region Partial Methods - + partial void OnContextCreated(); - + #endregion - + #region ObjectSet Properties - + /// /// No Metadata Documentation available. /// @@ -88,7 +88,7 @@ public ObjectSet
Addresses } } private ObjectSet
_Addresses; - + /// /// No Metadata Documentation available. /// @@ -104,7 +104,7 @@ public ObjectSet Contacts } } private ObjectSet _Contacts; - + /// /// No Metadata Documentation available. /// @@ -120,7 +120,7 @@ public ObjectSet Products } } private ObjectSet _Products; - + /// /// No Metadata Documentation available. /// @@ -136,7 +136,7 @@ public ObjectSet SalesOrderDetails } } private ObjectSet _SalesOrderDetails; - + /// /// No Metadata Documentation available. /// @@ -155,7 +155,7 @@ public ObjectSet SalesOrderHeaders #endregion #region AddTo Methods - + /// /// Deprecated Method for adding a new object to the Addresses EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// @@ -163,7 +163,7 @@ public void AddToAddresses(Address address) { base.AddObject("Addresses", address); } - + /// /// Deprecated Method for adding a new object to the Contacts EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// @@ -171,7 +171,7 @@ public void AddToContacts(Contact contact) { base.AddObject("Contacts", contact); } - + /// /// Deprecated Method for adding a new object to the Products EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// @@ -179,7 +179,7 @@ public void AddToProducts(Product product) { base.AddObject("Products", product); } - + /// /// Deprecated Method for adding a new object to the SalesOrderDetails EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// @@ -187,7 +187,7 @@ public void AddToSalesOrderDetails(SalesOrderDetail salesOrderDetail) { base.AddObject("SalesOrderDetails", salesOrderDetail); } - + /// /// Deprecated Method for adding a new object to the SalesOrderHeaders EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// @@ -198,12 +198,12 @@ public void AddToSalesOrderHeaders(SalesOrderHeader salesOrderHeader) #endregion } - + #endregion - + #region Entities - + /// /// No Metadata Documentation available. /// @@ -213,7 +213,7 @@ public void AddToSalesOrderHeaders(SalesOrderHeader salesOrderHeader) public partial class Address : EntityObject { #region Factory Method - + /// /// Create a new Address object. /// @@ -239,7 +239,7 @@ public static Address CreateAddress(global::System.Int32 addressID, global::Syst #endregion #region Primitive Properties - + /// /// No Metadata Documentation available. /// @@ -266,7 +266,7 @@ public static Address CreateAddress(global::System.Int32 addressID, global::Syst private global::System.Int32 _AddressID; partial void OnAddressIDChanging(global::System.Int32 value); partial void OnAddressIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -290,7 +290,7 @@ public static Address CreateAddress(global::System.Int32 addressID, global::Syst private global::System.String _AddressLine1; partial void OnAddressLine1Changing(global::System.String value); partial void OnAddressLine1Changed(); - + /// /// No Metadata Documentation available. /// @@ -314,7 +314,7 @@ public static Address CreateAddress(global::System.Int32 addressID, global::Syst private global::System.String _AddressLine2; partial void OnAddressLine2Changing(global::System.String value); partial void OnAddressLine2Changed(); - + /// /// No Metadata Documentation available. /// @@ -338,7 +338,7 @@ public static Address CreateAddress(global::System.Int32 addressID, global::Syst private global::System.String _City; partial void OnCityChanging(global::System.String value); partial void OnCityChanged(); - + /// /// No Metadata Documentation available. /// @@ -362,7 +362,7 @@ public static Address CreateAddress(global::System.Int32 addressID, global::Syst private global::System.Int32 _StateProvinceID; partial void OnStateProvinceIDChanging(global::System.Int32 value); partial void OnStateProvinceIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -386,7 +386,7 @@ public static Address CreateAddress(global::System.Int32 addressID, global::Syst private global::System.String _PostalCode; partial void OnPostalCodeChanging(global::System.String value); partial void OnPostalCodeChanged(); - + /// /// No Metadata Documentation available. /// @@ -410,7 +410,7 @@ public static Address CreateAddress(global::System.Int32 addressID, global::Syst private global::System.Guid _rowguid; partial void OnrowguidChanging(global::System.Guid value); partial void OnrowguidChanged(); - + /// /// No Metadata Documentation available. /// @@ -436,9 +436,9 @@ public static Address CreateAddress(global::System.Int32 addressID, global::Syst partial void OnModifiedDateChanged(); #endregion - + #region Navigation Properties - + /// /// No Metadata Documentation available. /// @@ -460,7 +460,7 @@ public EntityCollection SalesOrderHeaders } } } - + /// /// No Metadata Documentation available. /// @@ -485,7 +485,7 @@ public EntityCollection SalesOrderHeaders1 #endregion } - + /// /// No Metadata Documentation available. /// @@ -495,7 +495,7 @@ public EntityCollection SalesOrderHeaders1 public partial class Contact : EntityObject { #region Factory Method - + /// /// Create a new Contact object. /// @@ -525,7 +525,7 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst #endregion #region Primitive Properties - + /// /// No Metadata Documentation available. /// @@ -552,7 +552,7 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst private global::System.Int32 _ContactID; partial void OnContactIDChanging(global::System.Int32 value); partial void OnContactIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -576,7 +576,7 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst private global::System.Boolean _NameStyle; partial void OnNameStyleChanging(global::System.Boolean value); partial void OnNameStyleChanged(); - + /// /// No Metadata Documentation available. /// @@ -600,7 +600,7 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst private global::System.String _Title; partial void OnTitleChanging(global::System.String value); partial void OnTitleChanged(); - + /// /// No Metadata Documentation available. /// @@ -624,7 +624,7 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst private global::System.String _FirstName; partial void OnFirstNameChanging(global::System.String value); partial void OnFirstNameChanged(); - + /// /// No Metadata Documentation available. /// @@ -648,7 +648,7 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst private global::System.String _MiddleName; partial void OnMiddleNameChanging(global::System.String value); partial void OnMiddleNameChanged(); - + /// /// No Metadata Documentation available. /// @@ -672,7 +672,7 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst private global::System.String _LastName; partial void OnLastNameChanging(global::System.String value); partial void OnLastNameChanged(); - + /// /// No Metadata Documentation available. /// @@ -696,7 +696,7 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst private global::System.String _Suffix; partial void OnSuffixChanging(global::System.String value); partial void OnSuffixChanged(); - + /// /// No Metadata Documentation available. /// @@ -720,7 +720,7 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst private global::System.String _EmailAddress; partial void OnEmailAddressChanging(global::System.String value); partial void OnEmailAddressChanged(); - + /// /// No Metadata Documentation available. /// @@ -744,7 +744,7 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst private global::System.Int32 _EmailPromotion; partial void OnEmailPromotionChanging(global::System.Int32 value); partial void OnEmailPromotionChanged(); - + /// /// No Metadata Documentation available. /// @@ -768,7 +768,7 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst private global::System.String _Phone; partial void OnPhoneChanging(global::System.String value); partial void OnPhoneChanged(); - + /// /// No Metadata Documentation available. /// @@ -792,7 +792,7 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst private global::System.String _PasswordHash; partial void OnPasswordHashChanging(global::System.String value); partial void OnPasswordHashChanged(); - + /// /// No Metadata Documentation available. /// @@ -816,7 +816,7 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst private global::System.String _PasswordSalt; partial void OnPasswordSaltChanging(global::System.String value); partial void OnPasswordSaltChanged(); - + /// /// No Metadata Documentation available. /// @@ -840,7 +840,7 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst private global::System.String _AdditionalContactInfo; partial void OnAdditionalContactInfoChanging(global::System.String value); partial void OnAdditionalContactInfoChanged(); - + /// /// No Metadata Documentation available. /// @@ -864,7 +864,7 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst private global::System.Guid _rowguid; partial void OnrowguidChanging(global::System.Guid value); partial void OnrowguidChanged(); - + /// /// No Metadata Documentation available. /// @@ -890,9 +890,9 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst partial void OnModifiedDateChanged(); #endregion - + #region Navigation Properties - + /// /// No Metadata Documentation available. /// @@ -917,7 +917,7 @@ public EntityCollection SalesOrderHeaders #endregion } - + /// /// No Metadata Documentation available. /// @@ -927,7 +927,7 @@ public EntityCollection SalesOrderHeaders public partial class Product : EntityObject { #region Factory Method - + /// /// Create a new Product object. /// @@ -965,7 +965,7 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst #endregion #region Primitive Properties - + /// /// No Metadata Documentation available. /// @@ -992,7 +992,7 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst private global::System.Int32 _ProductID; partial void OnProductIDChanging(global::System.Int32 value); partial void OnProductIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1016,7 +1016,7 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst private global::System.String _Name; partial void OnNameChanging(global::System.String value); partial void OnNameChanged(); - + /// /// No Metadata Documentation available. /// @@ -1040,7 +1040,7 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst private global::System.String _ProductNumber; partial void OnProductNumberChanging(global::System.String value); partial void OnProductNumberChanged(); - + /// /// No Metadata Documentation available. /// @@ -1064,7 +1064,7 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst private global::System.Boolean _MakeFlag; partial void OnMakeFlagChanging(global::System.Boolean value); partial void OnMakeFlagChanged(); - + /// /// No Metadata Documentation available. /// @@ -1088,7 +1088,7 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst private global::System.Boolean _FinishedGoodsFlag; partial void OnFinishedGoodsFlagChanging(global::System.Boolean value); partial void OnFinishedGoodsFlagChanged(); - + /// /// No Metadata Documentation available. /// @@ -1112,7 +1112,7 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst private global::System.String _Color; partial void OnColorChanging(global::System.String value); partial void OnColorChanged(); - + /// /// No Metadata Documentation available. /// @@ -1136,7 +1136,7 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst private global::System.Int16 _SafetyStockLevel; partial void OnSafetyStockLevelChanging(global::System.Int16 value); partial void OnSafetyStockLevelChanged(); - + /// /// No Metadata Documentation available. /// @@ -1160,7 +1160,7 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst private global::System.Int16 _ReorderPoint; partial void OnReorderPointChanging(global::System.Int16 value); partial void OnReorderPointChanged(); - + /// /// No Metadata Documentation available. /// @@ -1184,7 +1184,7 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst private global::System.Decimal _StandardCost; partial void OnStandardCostChanging(global::System.Decimal value); partial void OnStandardCostChanged(); - + /// /// No Metadata Documentation available. /// @@ -1208,7 +1208,7 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst private global::System.Decimal _ListPrice; partial void OnListPriceChanging(global::System.Decimal value); partial void OnListPriceChanged(); - + /// /// No Metadata Documentation available. /// @@ -1232,7 +1232,7 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst private global::System.String _Size; partial void OnSizeChanging(global::System.String value); partial void OnSizeChanged(); - + /// /// No Metadata Documentation available. /// @@ -1256,7 +1256,7 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst private global::System.String _SizeUnitMeasureCode; partial void OnSizeUnitMeasureCodeChanging(global::System.String value); partial void OnSizeUnitMeasureCodeChanged(); - + /// /// No Metadata Documentation available. /// @@ -1280,7 +1280,7 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst private global::System.String _WeightUnitMeasureCode; partial void OnWeightUnitMeasureCodeChanging(global::System.String value); partial void OnWeightUnitMeasureCodeChanged(); - + /// /// No Metadata Documentation available. /// @@ -1304,7 +1304,7 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst private Nullable _Weight; partial void OnWeightChanging(Nullable value); partial void OnWeightChanged(); - + /// /// No Metadata Documentation available. /// @@ -1328,7 +1328,7 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst private global::System.Int32 _DaysToManufacture; partial void OnDaysToManufactureChanging(global::System.Int32 value); partial void OnDaysToManufactureChanged(); - + /// /// No Metadata Documentation available. /// @@ -1352,7 +1352,7 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst private global::System.String _ProductLine; partial void OnProductLineChanging(global::System.String value); partial void OnProductLineChanged(); - + /// /// No Metadata Documentation available. /// @@ -1376,7 +1376,7 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst private global::System.String _Class; partial void OnClassChanging(global::System.String value); partial void OnClassChanged(); - + /// /// No Metadata Documentation available. /// @@ -1400,7 +1400,7 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst private global::System.String _Style; partial void OnStyleChanging(global::System.String value); partial void OnStyleChanged(); - + /// /// No Metadata Documentation available. /// @@ -1424,7 +1424,7 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst private Nullable _ProductSubcategoryID; partial void OnProductSubcategoryIDChanging(Nullable value); partial void OnProductSubcategoryIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1448,7 +1448,7 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst private Nullable _ProductModelID; partial void OnProductModelIDChanging(Nullable value); partial void OnProductModelIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1472,7 +1472,7 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst private global::System.DateTime _SellStartDate; partial void OnSellStartDateChanging(global::System.DateTime value); partial void OnSellStartDateChanged(); - + /// /// No Metadata Documentation available. /// @@ -1496,7 +1496,7 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst private Nullable _SellEndDate; partial void OnSellEndDateChanging(Nullable value); partial void OnSellEndDateChanged(); - + /// /// No Metadata Documentation available. /// @@ -1520,7 +1520,7 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst private Nullable _DiscontinuedDate; partial void OnDiscontinuedDateChanging(Nullable value); partial void OnDiscontinuedDateChanged(); - + /// /// No Metadata Documentation available. /// @@ -1544,7 +1544,7 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst private global::System.Guid _rowguid; partial void OnrowguidChanging(global::System.Guid value); partial void OnrowguidChanged(); - + /// /// No Metadata Documentation available. /// @@ -1570,9 +1570,9 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst partial void OnModifiedDateChanged(); #endregion - + } - + /// /// No Metadata Documentation available. /// @@ -1582,7 +1582,7 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst public partial class SalesOrderDetail : EntityObject { #region Factory Method - + /// /// Create a new SalesOrderDetail object. /// @@ -1614,7 +1614,7 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales #endregion #region Primitive Properties - + /// /// No Metadata Documentation available. /// @@ -1641,7 +1641,7 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales private global::System.Int32 _SalesOrderID; partial void OnSalesOrderIDChanging(global::System.Int32 value); partial void OnSalesOrderIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1668,7 +1668,7 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales private global::System.Int32 _SalesOrderDetailID; partial void OnSalesOrderDetailIDChanging(global::System.Int32 value); partial void OnSalesOrderDetailIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1692,7 +1692,7 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales private global::System.String _CarrierTrackingNumber; partial void OnCarrierTrackingNumberChanging(global::System.String value); partial void OnCarrierTrackingNumberChanged(); - + /// /// No Metadata Documentation available. /// @@ -1716,7 +1716,7 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales private global::System.Int16 _OrderQty; partial void OnOrderQtyChanging(global::System.Int16 value); partial void OnOrderQtyChanged(); - + /// /// No Metadata Documentation available. /// @@ -1740,7 +1740,7 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales private global::System.Int32 _ProductID; partial void OnProductIDChanging(global::System.Int32 value); partial void OnProductIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1764,7 +1764,7 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales private global::System.Int32 _SpecialOfferID; partial void OnSpecialOfferIDChanging(global::System.Int32 value); partial void OnSpecialOfferIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1788,7 +1788,7 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales private global::System.Decimal _UnitPrice; partial void OnUnitPriceChanging(global::System.Decimal value); partial void OnUnitPriceChanged(); - + /// /// No Metadata Documentation available. /// @@ -1812,7 +1812,7 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales private global::System.Decimal _UnitPriceDiscount; partial void OnUnitPriceDiscountChanging(global::System.Decimal value); partial void OnUnitPriceDiscountChanged(); - + /// /// No Metadata Documentation available. /// @@ -1836,7 +1836,7 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales private global::System.Decimal _LineTotal; partial void OnLineTotalChanging(global::System.Decimal value); partial void OnLineTotalChanged(); - + /// /// No Metadata Documentation available. /// @@ -1860,7 +1860,7 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales private global::System.Guid _rowguid; partial void OnrowguidChanging(global::System.Guid value); partial void OnrowguidChanged(); - + /// /// No Metadata Documentation available. /// @@ -1886,9 +1886,9 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales partial void OnModifiedDateChanged(); #endregion - + #region Navigation Properties - + /// /// No Metadata Documentation available. /// @@ -1929,7 +1929,7 @@ public EntityReference SalesOrderHeaderReference #endregion } - + /// /// No Metadata Documentation available. /// @@ -1939,7 +1939,7 @@ public EntityReference SalesOrderHeaderReference public partial class SalesOrderHeader : EntityObject { #region Factory Method - + /// /// Create a new SalesOrderHeader object. /// @@ -1987,7 +1987,7 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales #endregion #region Primitive Properties - + /// /// No Metadata Documentation available. /// @@ -2014,7 +2014,7 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales private global::System.Int32 _SalesOrderID; partial void OnSalesOrderIDChanging(global::System.Int32 value); partial void OnSalesOrderIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2038,7 +2038,7 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales private global::System.Byte _RevisionNumber; partial void OnRevisionNumberChanging(global::System.Byte value); partial void OnRevisionNumberChanged(); - + /// /// No Metadata Documentation available. /// @@ -2062,7 +2062,7 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales private global::System.DateTime _OrderDate; partial void OnOrderDateChanging(global::System.DateTime value); partial void OnOrderDateChanged(); - + /// /// No Metadata Documentation available. /// @@ -2086,7 +2086,7 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales private global::System.DateTime _DueDate; partial void OnDueDateChanging(global::System.DateTime value); partial void OnDueDateChanged(); - + /// /// No Metadata Documentation available. /// @@ -2110,7 +2110,7 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales private Nullable _ShipDate; partial void OnShipDateChanging(Nullable value); partial void OnShipDateChanged(); - + /// /// No Metadata Documentation available. /// @@ -2134,7 +2134,7 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales private global::System.Byte _Status; partial void OnStatusChanging(global::System.Byte value); partial void OnStatusChanged(); - + /// /// No Metadata Documentation available. /// @@ -2158,7 +2158,7 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales private global::System.Boolean _OnlineOrderFlag; partial void OnOnlineOrderFlagChanging(global::System.Boolean value); partial void OnOnlineOrderFlagChanged(); - + /// /// No Metadata Documentation available. /// @@ -2182,7 +2182,7 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales private global::System.String _SalesOrderNumber; partial void OnSalesOrderNumberChanging(global::System.String value); partial void OnSalesOrderNumberChanged(); - + /// /// No Metadata Documentation available. /// @@ -2206,7 +2206,7 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales private global::System.String _PurchaseOrderNumber; partial void OnPurchaseOrderNumberChanging(global::System.String value); partial void OnPurchaseOrderNumberChanged(); - + /// /// No Metadata Documentation available. /// @@ -2230,7 +2230,7 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales private global::System.String _AccountNumber; partial void OnAccountNumberChanging(global::System.String value); partial void OnAccountNumberChanged(); - + /// /// No Metadata Documentation available. /// @@ -2254,7 +2254,7 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales private global::System.Int32 _CustomerID; partial void OnCustomerIDChanging(global::System.Int32 value); partial void OnCustomerIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2278,7 +2278,7 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales private global::System.Int32 _ContactID; partial void OnContactIDChanging(global::System.Int32 value); partial void OnContactIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2302,7 +2302,7 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales private Nullable _SalesPersonID; partial void OnSalesPersonIDChanging(Nullable value); partial void OnSalesPersonIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2326,7 +2326,7 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales private Nullable _TerritoryID; partial void OnTerritoryIDChanging(Nullable value); partial void OnTerritoryIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2350,7 +2350,7 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales private global::System.Int32 _BillToAddressID; partial void OnBillToAddressIDChanging(global::System.Int32 value); partial void OnBillToAddressIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2374,7 +2374,7 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales private global::System.Int32 _ShipToAddressID; partial void OnShipToAddressIDChanging(global::System.Int32 value); partial void OnShipToAddressIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2398,7 +2398,7 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales private global::System.Int32 _ShipMethodID; partial void OnShipMethodIDChanging(global::System.Int32 value); partial void OnShipMethodIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2422,7 +2422,7 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales private Nullable _CreditCardID; partial void OnCreditCardIDChanging(Nullable value); partial void OnCreditCardIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2446,7 +2446,7 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales private global::System.String _CreditCardApprovalCode; partial void OnCreditCardApprovalCodeChanging(global::System.String value); partial void OnCreditCardApprovalCodeChanged(); - + /// /// No Metadata Documentation available. /// @@ -2470,7 +2470,7 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales private Nullable _CurrencyRateID; partial void OnCurrencyRateIDChanging(Nullable value); partial void OnCurrencyRateIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2494,7 +2494,7 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales private global::System.Decimal _SubTotal; partial void OnSubTotalChanging(global::System.Decimal value); partial void OnSubTotalChanged(); - + /// /// No Metadata Documentation available. /// @@ -2518,7 +2518,7 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales private global::System.Decimal _TaxAmt; partial void OnTaxAmtChanging(global::System.Decimal value); partial void OnTaxAmtChanged(); - + /// /// No Metadata Documentation available. /// @@ -2542,7 +2542,7 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales private global::System.Decimal _Freight; partial void OnFreightChanging(global::System.Decimal value); partial void OnFreightChanged(); - + /// /// No Metadata Documentation available. /// @@ -2566,7 +2566,7 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales private global::System.Decimal _TotalDue; partial void OnTotalDueChanging(global::System.Decimal value); partial void OnTotalDueChanged(); - + /// /// No Metadata Documentation available. /// @@ -2590,7 +2590,7 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales private global::System.String _Comment; partial void OnCommentChanging(global::System.String value); partial void OnCommentChanged(); - + /// /// No Metadata Documentation available. /// @@ -2614,7 +2614,7 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales private global::System.Guid _rowguid; partial void OnrowguidChanging(global::System.Guid value); partial void OnrowguidChanged(); - + /// /// No Metadata Documentation available. /// @@ -2640,9 +2640,9 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales partial void OnModifiedDateChanged(); #endregion - + #region Navigation Properties - + /// /// No Metadata Documentation available. /// @@ -2680,7 +2680,7 @@ public EntityReference
AddressReference } } } - + /// /// No Metadata Documentation available. /// @@ -2718,7 +2718,7 @@ public EntityReference
Address1Reference } } } - + /// /// No Metadata Documentation available. /// @@ -2756,7 +2756,7 @@ public EntityReference ContactReference } } } - + /// /// No Metadata Documentation available. /// @@ -2783,5 +2783,5 @@ public EntityCollection SalesOrderDetails } #endregion - + } diff --git a/samples/snippets/csharp/VS_Snippets_Data/dp entityservices concepts/cs/entitysql.cs b/samples/snippets/csharp/VS_Snippets_Data/dp entityservices concepts/cs/entitysql.cs index 2037970aa0292..3494251eb7efa 100644 --- a/samples/snippets/csharp/VS_Snippets_Data/dp entityservices concepts/cs/entitysql.cs +++ b/samples/snippets/csharp/VS_Snippets_Data/dp entityservices concepts/cs/entitysql.cs @@ -20,11 +20,11 @@ public static void TestEntitySQL() Dictionary pc = new Dictionary(); /* // - SELECT VALUE product FROM AdventureWorksEntities.Products AS product + SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice = @price1 + @price2 // */ - string queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products AS product + string queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice = @price1 + @price2"; pc.Add("price1", 120); @@ -41,22 +41,22 @@ SELECT VALUE Product FROM AdventureWorksEntities.Products AS Product /* // - SELECT VALUE 'Name=[' + e.Name + ']' FROM + SELECT VALUE 'Name=[' + e.Name + ']' FROM AdventureWorksEntities.Products AS e // */ - queryString = @"SELECT VALUE 'Name=[' + e.Name + ']' FROM + queryString = @"SELECT VALUE 'Name=[' + e.Name + ']' FROM AdventureWorksEntities.Products AS e"; TestProduct(queryString, pc); /* // - SELECT VALUE product FROM AdventureWorksEntities.Products + SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice = -(-@price) // */ - queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products + queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice = -(-@price)"; pc.Add("price", 120); @@ -65,11 +65,11 @@ SELECT VALUE product FROM AdventureWorksEntities.Products /* // - SELECT VALUE product FROM AdventureWorksEntities.Products + SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice = @price1 - @price2 // */ - queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products + queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice = @price1 - @price2"; pc.Add("price1", 127); pc.Add("price2", 2); @@ -78,11 +78,11 @@ SELECT VALUE product FROM AdventureWorksEntities.Products /* // - SELECT VALUE product FROM AdventureWorksEntities.Products + SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice = @price1 * @price2 // */ - queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products + queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice = @price1 * @price2"; pc.Add("price1", 25); pc.Add("price2", 5); @@ -91,11 +91,11 @@ SELECT VALUE product FROM AdventureWorksEntities.Products /* // - SELECT VALUE product FROM AdventureWorksEntities.Products + SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice = @price1 / @price2 // */ - queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products + queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice = @price1 / @price2"; pc.Add("price1", 120); pc.Add("price2", 2); @@ -104,11 +104,11 @@ SELECT VALUE product FROM AdventureWorksEntities.Products /* // - SELECT VALUE product FROM AdventureWorksEntities.Products + SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice = @price1 % @price2 // */ - queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products + queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice = @price1 % @price2"; pc.Add("price1", 125); pc.Add("price2", 1); @@ -117,14 +117,14 @@ SELECT VALUE product FROM AdventureWorksEntities.Products /* // -- AND - SELECT VALUE product FROM AdventureWorksEntities.Products + SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice > @price1 AND product.ListPrice < @price2 - -- && - SELECT VALUE product FROM AdventureWorksEntities.Products + -- && + SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice > @price1 && product.ListPrice < @price2 // */ - queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products + queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice > @price1 AND product.ListPrice < @price2"; pc.Add("price1", 10); @@ -135,14 +135,14 @@ AS product where product.ListPrice > @price1 && product.ListPrice < @price2 /* // -- OR - SELECT VALUE product FROM AdventureWorksEntities.Products + SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice = @price1 OR product.ListPrice = @price2 - -- || - SELECT VALUE product FROM AdventureWorksEntities.Products + -- || + SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice = @price1 || product.ListPrice = @price2 // */ - queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products + queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice = @price1 OR product.ListPrice = @price2"; pc.Add("price1", 40); pc.Add("price2", 125); @@ -151,14 +151,14 @@ SELECT VALUE product FROM AdventureWorksEntities.Products /* // -- NOT - SELECT VALUE product FROM AdventureWorksEntities.Products + SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice > @price1 AND NOT (product.ListPrice = @price2) -- ! - SELECT VALUE product FROM AdventureWorksEntities.Products + SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice > @price1 AND ! (product.ListPrice = @price2) // */ - queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products + queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice > @price1 AND NOT (product.ListPrice = @price2)"; pc.Add("price1", 50); pc.Add("price2", 90); @@ -167,11 +167,11 @@ SELECT VALUE product FROM AdventureWorksEntities.Products /* // - SELECT VALUE product FROM AdventureWorksEntities.Products + SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice = @price // */ - queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products + queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice = @price"; pc.Add("price", 125); @@ -179,11 +179,11 @@ SELECT VALUE product FROM AdventureWorksEntities.Products pc.Clear(); /* // - SELECT VALUE product FROM AdventureWorksEntities.Products + SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice > @price // */ - queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products + queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice > @price"; pc.Add("price", 125); TestProduct(queryString, pc); @@ -191,11 +191,11 @@ AS product where product.ListPrice > @price /* // - SELECT VALUE product FROM AdventureWorksEntities.Products + SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice >= @price // */ - queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products + queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice >= @price"; pc.Add("price", 125); TestProduct(queryString, pc); @@ -203,11 +203,11 @@ SELECT VALUE product FROM AdventureWorksEntities.Products /* // - SELECT VALUE product FROM AdventureWorksEntities.Products + SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice < @price // */ - queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products + queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice < @price"; pc.Add("price", 125); TestProduct(queryString, pc); @@ -215,11 +215,11 @@ AS product where product.ListPrice < @price /* // - SELECT VALUE product FROM AdventureWorksEntities.Products + SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice <= @price // */ - queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products + queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice <= @price"; pc.Add("price", 125); TestProduct(queryString, pc); @@ -228,16 +228,16 @@ SELECT VALUE product FROM AdventureWorksEntities.Products /* // -- != - SELECT VALUE product FROM AdventureWorksEntities.Products + SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice != @price -- <> - SELECT VALUE product FROM AdventureWorksEntities.Products + SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice <> @price // */ - queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products + queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice != @price"; - + pc.Add("price", 0); TestProduct(queryString, pc); pc.Clear(); @@ -260,20 +260,20 @@ SELECT VALUE product FROM AdventureWorksEntities.Products AS product -- add a co pc.Add("price", 125); TestProduct(queryString, pc); pc.Clear(); - + /* // - SELECT VALUE product FROM AdventureWorksEntities.Products + SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice BETWEEN @price1 AND @price2 // */ - queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products + queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products AS product where product.ListPrice BETWEEN @price1 AND @price2"; pc.Add("price1", 50); pc.Add("price2", 90); TestProduct(queryString, pc); - pc.Clear(); - + pc.Clear(); + /* // CASE WHEN AVG({@score1,@score2,@score3}) < @total THEN TRUE ELSE FALSE END @@ -285,27 +285,27 @@ CASE WHEN AVG({@score1,@score2,@score3}) < @total THEN TRUE ELSE FALSE END pc.Add("score3", 11); pc.Add("total", 100); TestProduct(queryString, pc); - pc.Clear(); - + pc.Clear(); + /* // - SELECT VALUE cast(p.ListPrice as Edm.Int32) + SELECT VALUE cast(p.ListPrice as Edm.Int32) FROM AdventureWorksEntities.Products as p order by p.ListPrice // */ - queryString = @"SELECT VALUE cast(p.ListPrice as Edm.Int32) + queryString = @"SELECT VALUE cast(p.ListPrice as Edm.Int32) FROM AdventureWorksEntities.Products as p order by p.ListPrice"; /* // - SELECT VALUE Key(CreateRef(AdventureWorksEntities.Products, + SELECT VALUE Key(CreateRef(AdventureWorksEntities.Products, row(p.ProductID))) FROM AdventureWorksEntities.Products as p // */ - queryString = @"SELECT VALUE Key(CreateRef(AdventureWorksEntities.Products, + queryString = @"SELECT VALUE Key(CreateRef(AdventureWorksEntities.Products, row(p.ProductID))) FROM AdventureWorksEntities.Products as p"; /* // - SELECT VALUE DEREF(REF(p)).Name FROM AdventureWorksEntities.Products + SELECT VALUE DEREF(REF(p)).Name FROM AdventureWorksEntities.Products as p // */ @@ -313,15 +313,15 @@ as p /* // - (SELECT product from AdventureWorksEntities.Products as product - WHERE product.ListPrice > @price1 ) except - (select product from AdventureWorksEntities.Products as product + (SELECT product from AdventureWorksEntities.Products as product + WHERE product.ListPrice > @price1 ) except + (select product from AdventureWorksEntities.Products as product WHERE product.ListPrice > @price2) // */ - queryString = @"(SELECT product from AdventureWorksEntities.Products as product - WHERE product.ListPrice > @price1 ) except - (select product from AdventureWorksEntities.Products as product + queryString = @"(SELECT product from AdventureWorksEntities.Products as product + WHERE product.ListPrice > @price1 ) except + (select product from AdventureWorksEntities.Products as product WHERE product.ListPrice > @price2)"; pc.Add("price1", 20); pc.Add("price2", 50); @@ -330,13 +330,13 @@ as p /* // - SELECT VALUE name from AdventureWorksEntities.Products - AS name where exists(SELECT A from AdventureWorksEntities.Products + SELECT VALUE name from AdventureWorksEntities.Products + AS name where exists(SELECT A from AdventureWorksEntities.Products as A WHERE A.ListPrice < @price1) // */ - queryString = @"SELECT VALUE name from AdventureWorksEntities.Products - AS name where exists(SELECT A from AdventureWorksEntities.Products + queryString = @"SELECT VALUE name from AdventureWorksEntities.Products + AS name where exists(SELECT A from AdventureWorksEntities.Products as A WHERE A.ListPrice < @price)"; pc.Add("price", 20); TestProduct(queryString, pc); @@ -344,17 +344,17 @@ AS name where exists(SELECT A from AdventureWorksEntities.Products /* // - FLATTEN(SELECT VALUE c.SalesOrderHeaders From + FLATTEN(SELECT VALUE c.SalesOrderHeaders From AdventureWorksEntities.Contacts as c) // */ - queryString = @"FLATTEN(SELECT VALUE c.SalesOrderHeaders From + queryString = @"FLATTEN(SELECT VALUE c.SalesOrderHeaders From AdventureWorksEntities.Contacts as c)"; /* // USING Microsoft.Samples.Entity; - FUNCTION Products(listPrice Int32) AS + FUNCTION Products(listPrice Int32) AS ( SELECT VALUE p FROM AdventureWorksEntities.Products AS p WHERE p.ListPrice >= listPrice ) @@ -362,7 +362,7 @@ select p from Products(@price) as p // */ queryString = @"USING Microsoft.Samples.Entity; - FUNCTION Products(listPrice Int32) AS + FUNCTION Products(listPrice Int32) AS ( SELECT VALUE p FROM AdventureWorksEntities.Products AS p WHERE p.ListPrice >= listPrice ) @@ -374,7 +374,7 @@ FUNCTION Products(listPrice Int32) AS /* // USING Microsoft.Samples.Entity; - FUNCTION GetSpecificContacts(Ids Collection(Int32)) AS + FUNCTION GetSpecificContacts(Ids Collection(Int32)) AS ( SELECT VALUE id FROM Ids AS id WHERE id < @price ) @@ -383,7 +383,7 @@ SELECT VALUE id FROM Ids AS id WHERE id < @price */ queryString = @" USING Microsoft.Samples.Entity; - FUNCTION GetSpecificContacts(Ids Collection(Int32)) AS + FUNCTION GetSpecificContacts(Ids Collection(Int32)) AS ( SELECT VALUE id FROM Ids AS id WHERE id < @price ) @@ -395,41 +395,41 @@ SELECT VALUE id FROM Ids AS id WHERE id < @price /* // - SELECT VALUE name FROM AdventureWorksEntities.Products + SELECT VALUE name FROM AdventureWorksEntities.Products as P GROUP BY P.Name HAVING MAX(P.ListPrice) > @price // */ - queryString = @"SELECT VALUE name FROM AdventureWorksEntities.Products + queryString = @"SELECT VALUE name FROM AdventureWorksEntities.Products as P GROUP BY P.Name HAVING MAX(P.ListPrice) > @price"; pc.Add("price", 10); TestProduct(queryString, pc); pc.Clear(); /* // - SELECT VALUE name FROM AdventureWorksEntities.Products + SELECT VALUE name FROM AdventureWorksEntities.Products as P GROUP BY P.Name HAVING MAX(P.ListPrice) > @price // */ - queryString = @"SELECT VALUE name FROM AdventureWorksEntities.Products + queryString = @"SELECT VALUE name FROM AdventureWorksEntities.Products as P GROUP BY P.Name HAVING MAX(P.ListPrice) > @price"; pc.Add("price", 10); TestProduct(queryString, pc); pc.Clear(); /* // - SELECT VALUE Key(CreateRef(AdventureWorksEntities.Products, + SELECT VALUE Key(CreateRef(AdventureWorksEntities.Products, row(p.ProductID))) FROM AdventureWorksEntities.Products as p // */ - queryString = @"SELECT VALUE Key(CreateRef(AdventureWorksEntities.Products, + queryString = @"SELECT VALUE Key(CreateRef(AdventureWorksEntities.Products, row(p.ProductID))) FROM AdventureWorksEntities.Products as p"; /* // - SELECT VALUE product FROM AdventureWorksEntities.Products + SELECT VALUE product FROM AdventureWorksEntities.Products AS product WHERE product.ListPrice IN {125, 300} // */ - queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products + queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products AS product WHERE product.ListPrice IN {@price1, @price2}"; pc.Add("price1", 125); pc.Add("price2", 300); @@ -437,13 +437,13 @@ SELECT VALUE product FROM AdventureWorksEntities.Products pc.Clear(); /* // - (SELECT product from AdventureWorksEntities.Products as product where product.ListPrice > @price1 ) - intersect (select product from AdventureWorksEntities.Products as + (SELECT product from AdventureWorksEntities.Products as product where product.ListPrice > @price1 ) + intersect (select product from AdventureWorksEntities.Products as product where product.ListPrice > @price2) // */ - queryString = @"(SELECT product from AdventureWorksEntities.Products as product where product.ListPrice > @price1 ) - intersect (select product from AdventureWorksEntities.Products as + queryString = @"(SELECT product from AdventureWorksEntities.Products as product where product.ListPrice > @price1 ) + intersect (select product from AdventureWorksEntities.Products as product where product.ListPrice > @price2)"; pc.Add("price1", 10); pc.Add("price2", 20); @@ -452,35 +452,35 @@ SELECT VALUE product FROM AdventureWorksEntities.Products /* // - SELECT VALUE product FROM AdventureWorksEntities.Products + SELECT VALUE product FROM AdventureWorksEntities.Products AS product WHERE product.Color IS NOT NULL // */ - queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products + queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products AS product WHERE product.Color IS NOT NULL"; /* // -- LIKE and ESCAPE - -- If an AdventureWorksEntities.Products contained a Name - -- with the value 'Down_Tube', the following query would find that + -- If an AdventureWorksEntities.Products contained a Name + -- with the value 'Down_Tube', the following query would find that -- value. - Select value P.Name FROM AdventureWorksEntities.Products + Select value P.Name FROM AdventureWorksEntities.Products as P where P.Name LIKE 'DownA_%' ESCAPE 'A' -- LIKE - Select value P.Name FROM AdventureWorksEntities.Products + Select value P.Name FROM AdventureWorksEntities.Products as P where P.Name like 'BB%' // */ - queryString = @"Select value P.Name FROM AdventureWorksEntities.Products + queryString = @"Select value P.Name FROM AdventureWorksEntities.Products as P where P.Name like 'BB%'"; /* // - SELECT VALUE p FROM AdventureWorksEntities.Products + SELECT VALUE p FROM AdventureWorksEntities.Products AS p order by p.ListPrice LIMIT(@limit) // */ - queryString = @"SELECT VALUE p FROM AdventureWorksEntities.Products + queryString = @"SELECT VALUE p FROM AdventureWorksEntities.Products AS p order by p.ListPrice LIMIT(@limit)"; pc.Add("limit", 5); TestProduct(queryString, pc); @@ -488,11 +488,11 @@ AS p order by p.ListPrice LIMIT(@limit) /* // - SELECT VALUE product FROM AdventureWorksEntities.Products + SELECT VALUE product FROM AdventureWorksEntities.Products AS product WHERE product.ListPrice IN MultiSet (@price1, @price2) // */ - queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products + queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products AS product WHERE product.ListPrice IN MultiSet (@price1, @price2)"; pc.Add("price1", 125); pc.Add("price2", 300); @@ -516,42 +516,42 @@ FROM AdventureWorksEntities.SalesOrderDetails AS o FROM AdventureWorksEntities.SalesOrderDetails AS o"; /* // - SELECT address.AddressID, (SELECT VALUE DEREF(soh) + SELECT address.AddressID, (SELECT VALUE DEREF(soh) FROM NAVIGATE(address, AdventureWorksModel.FK_SalesOrderHeader_Address_BillToAddressID) AS soh) FROM AdventureWorksEntities.Addresses AS address // */ - queryString = @"SELECT address.AddressID, (SELECT VALUE DEREF(soh) + queryString = @"SELECT address.AddressID, (SELECT VALUE DEREF(soh) FROM NAVIGATE(address, AdventureWorksModel.FK_SalesOrderHeader_Address_BillToAddressID) AS soh) FROM AdventureWorksEntities.Addresses AS address"; /* // - SELECT onsiteCourse.Location FROM - OFTYPE(SchoolEntities.Courses, SchoolModel.OnsiteCourse) - AS onsiteCourse + SELECT onsiteCourse.Location FROM + OFTYPE(SchoolEntities.Courses, SchoolModel.OnsiteCourse) + AS onsiteCourse // */ - queryString = @"SELECT onsiteCourse.Location FROM - OFTYPE(SchoolEntities.Courses, SchoolModel.OnsiteCourse) + queryString = @"SELECT onsiteCourse.Location FROM + OFTYPE(SchoolEntities.Courses, SchoolModel.OnsiteCourse) AS onsiteCourse"; /* // - SELECT VALUE p FROM AdventureWorksEntities.Products + SELECT VALUE p FROM AdventureWorksEntities.Products AS p order by p.ListPrice // */ - queryString = @"SELECT VALUE p FROM AdventureWorksEntities.Products + queryString = @"SELECT VALUE p FROM AdventureWorksEntities.Products AS p order by p.ListPrice"; /* // - SELECT value P from AdventureWorksEntities.Products - as P WHERE ((select P from AdventureWorksEntities.Products + SELECT value P from AdventureWorksEntities.Products + as P WHERE ((select P from AdventureWorksEntities.Products as P WHERE P.ListPrice > @price1) overlaps (select P from AdventureWorksEntities.Products as P WHERE P.ListPrice < @price2)) // */ - queryString = @"SELECT value P from AdventureWorksEntities.Products - as P WHERE ((select P from AdventureWorksEntities.Products + queryString = @"SELECT value P from AdventureWorksEntities.Products + as P WHERE ((select P from AdventureWorksEntities.Products as P WHERE P.ListPrice > @price1) overlaps (select P from AdventureWorksEntities.Products as P WHERE P.ListPrice < @price2))"; pc.Add("price1", 10); @@ -601,11 +601,11 @@ AS product queryString = @"SET(SELECT VALUE P.Name FROM AdventureWorksEntities.Products AS P)"; /* // - SELECT VALUE p FROM AdventureWorksEntities.Products + SELECT VALUE p FROM AdventureWorksEntities.Products AS p order by p.ListPrice SKIP(@price) // */ - queryString = @"SELECT VALUE p FROM AdventureWorksEntities.Products + queryString = @"SELECT VALUE p FROM AdventureWorksEntities.Products AS p order by p.ListPrice SKIP(@price)"; pc.Add("price", 10); TestProduct(queryString, pc); @@ -619,119 +619,119 @@ SELECT VALUE TOP(1) contact FROM AdventureWorksEntities.Contacts AS contact queryString = @"SELECT VALUE TOP(1) contact FROM AdventureWorksEntities.Contacts AS contact"; /* // - SELECT VALUE TREAT (course as SchoolModel.OnsiteCourse) + SELECT VALUE TREAT (course as SchoolModel.OnsiteCourse) FROM SchoolEntities.Courses as course WHERE course IS OF( SchoolModel.OnsiteCourse) // */ - queryString = @"SELECT VALUE TREAT (course as SchoolModel.OnsiteCourse) + queryString = @"SELECT VALUE TREAT (course as SchoolModel.OnsiteCourse) FROM SchoolEntities.Courses as course WHERE course IS OF( SchoolModel.OnsiteCourse)"; /* // - (SELECT VALUE P from AdventureWorksEntities.Products - as P WHERE P.Name LIKE 'C%') Union All - ( SELECT VALUE A from AdventureWorksEntities.Products + (SELECT VALUE P from AdventureWorksEntities.Products + as P WHERE P.Name LIKE 'C%') Union All + ( SELECT VALUE A from AdventureWorksEntities.Products as A WHERE A.ListPrice > @price) // */ - queryString = @"(SELECT VALUE P from AdventureWorksEntities.Products - as P WHERE P.Name LIKE 'C%') Union All - (SELECT VALUE A from AdventureWorksEntities.Products + queryString = @"(SELECT VALUE P from AdventureWorksEntities.Products + as P WHERE P.Name LIKE 'C%') Union All + (SELECT VALUE A from AdventureWorksEntities.Products as A WHERE A.ListPrice > @price)"; pc.Add("price", 10); TestProduct(queryString, pc); pc.Clear(); /* - SELECT VALUE AVG(p.ListPrice) FROM AdventureWorksEntities.Products as p + SELECT VALUE AVG(p.ListPrice) FROM AdventureWorksEntities.Products as p */ // - queryString = @"SELECT VALUE AVG(p.ListPrice) + queryString = @"SELECT VALUE AVG(p.ListPrice) FROM AdventureWorksEntities.Products as p"; // /* - SELECT VALUE BigCount(p.ProductID) FROM AdventureWorksEntities.Products as p + SELECT VALUE BigCount(p.ProductID) FROM AdventureWorksEntities.Products as p */ // - queryString = @"SELECT VALUE BigCount(p.ProductID) + queryString = @"SELECT VALUE BigCount(p.ProductID) FROM AdventureWorksEntities.Products as p"; // /* - SELECT VALUE Count(p.ProductID) FROM AdventureWorksEntities.Products as p + SELECT VALUE Count(p.ProductID) FROM AdventureWorksEntities.Products as p */ // - queryString = @"SELECT VALUE Count(p.ProductID) + queryString = @"SELECT VALUE Count(p.ProductID) FROM AdventureWorksEntities.Products as p"; // /* - SELECT VALUE MAX(p.ListPrice) FROM AdventureWorksEntities.Products as p + SELECT VALUE MAX(p.ListPrice) FROM AdventureWorksEntities.Products as p */ // - queryString = @"SELECT VALUE MAX(p.ListPrice) + queryString = @"SELECT VALUE MAX(p.ListPrice) FROM AdventureWorksEntities.Products as p"; // /* - SELECT VALUE MIN(p.ListPrice) FROM AdventureWorksEntities.Products as p + SELECT VALUE MIN(p.ListPrice) FROM AdventureWorksEntities.Products as p */ // - queryString = @"SELECT VALUE MIN(p.ListPrice) + queryString = @"SELECT VALUE MIN(p.ListPrice) FROM AdventureWorksEntities.Products as p"; // /* - SELECT VALUE StDev(product.ListPrice) - FROM AdventureWorksEntities.Products AS product + SELECT VALUE StDev(product.ListPrice) + FROM AdventureWorksEntities.Products AS product where product.ListPrice > @price */ // - queryString = @"SELECT VALUE StDev(product.ListPrice) - FROM AdventureWorksEntities.Products AS product + queryString = @"SELECT VALUE StDev(product.ListPrice) + FROM AdventureWorksEntities.Products AS product WHERE product.ListPrice > @price"; // pc.Add("price", 20); TestProduct(queryString, pc); pc.Clear(); /* - SELECT VALUE StDevP(product.ListPrice) - FROM AdventureWorksEntities.Products AS product + SELECT VALUE StDevP(product.ListPrice) + FROM AdventureWorksEntities.Products AS product where product.ListPrice > @price */ // - queryString = @"SELECT VALUE StDevP(product.ListPrice) - FROM AdventureWorksEntities.Products AS product + queryString = @"SELECT VALUE StDevP(product.ListPrice) + FROM AdventureWorksEntities.Products AS product WHERE product.ListPrice > @price"; // pc.Add("price", 20); TestProduct(queryString, pc); pc.Clear(); /* - SELECT VALUE Sum(p.ListPrice) FROM AdventureWorksEntities.Products as p + SELECT VALUE Sum(p.ListPrice) FROM AdventureWorksEntities.Products as p */ // - queryString = @"SELECT VALUE Sum(p.ListPrice) + queryString = @"SELECT VALUE Sum(p.ListPrice) FROM AdventureWorksEntities.Products as p"; // /* - SELECT VALUE Var(product.ListPrice) - FROM AdventureWorksEntities.Products AS product + SELECT VALUE Var(product.ListPrice) + FROM AdventureWorksEntities.Products AS product WHERE product.ListPrice > @price */ // - queryString = @"SELECT VALUE Var(product.ListPrice) - FROM AdventureWorksEntities.Products AS product + queryString = @"SELECT VALUE Var(product.ListPrice) + FROM AdventureWorksEntities.Products AS product WHERE product.ListPrice > @price"; // pc.Add("price", 20); TestProduct(queryString, pc); pc.Clear(); /* - SELECT VALUE VarP(product.ListPrice) - FROM AdventureWorksEntities.Products AS product + SELECT VALUE VarP(product.ListPrice) + FROM AdventureWorksEntities.Products AS product WHERE product.ListPrice > @price */ // - queryString = @"SELECT VALUE VarP(product.ListPrice) - FROM AdventureWorksEntities.Products AS product + queryString = @"SELECT VALUE VarP(product.ListPrice) + FROM AdventureWorksEntities.Products AS product WHERE product.ListPrice > @price"; // pc.Add("price", 20); @@ -739,84 +739,84 @@ FROM AdventureWorksEntities.Products AS product pc.Clear(); /* // - SELECT VALUE product FROM AdventureWorksEntities.Products AS product + SELECT VALUE product FROM AdventureWorksEntities.Products AS product WHERE CEILING(product.ListPrice) == FLOOR(product.ListPrice) // */ - queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products AS product + queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products AS product WHERE CEILING(product.ListPrice) == FLOOR(product.ListPrice)"; /* // - SELECT VALUE product FROM AdventureWorksEntities.Products AS product + SELECT VALUE product FROM AdventureWorksEntities.Products AS product WHERE FLOOR(product.ListPrice) == CEILING(product.ListPrice) // */ - queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products AS product + queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products AS product WHERE FLOOR(product.ListPrice) == CEILING(product.ListPrice)"; - queryString = @"SELECT VALUE SqlServer.AVG(p.ListPrice) + queryString = @"SELECT VALUE SqlServer.AVG(p.ListPrice) FROM AdventureWorksEntities.Products as p "; - queryString = @"SELECT VALUE SqlServer.Checksum_Agg(cast(product.ListPrice as Int32)) - FROM AdventureWorksEntities.Products AS product + queryString = @"SELECT VALUE SqlServer.Checksum_Agg(cast(product.ListPrice as Int32)) + FROM AdventureWorksEntities.Products AS product WHERE product.ListPrice > cast(@price as Decimal) "; pc.Add("price", 20); TestProduct(queryString, pc); pc.Clear(); - queryString = @"ANYELEMENT(SELECT VALUE SqlServer.COUNT(product.ProductID) - FROM AdventureWorksEntities.Products AS product - WHERE SqlServer.CEILING(product.ListPrice) == + queryString = @"ANYELEMENT(SELECT VALUE SqlServer.COUNT(product.ProductID) + FROM AdventureWorksEntities.Products AS product + WHERE SqlServer.CEILING(product.ListPrice) == SqlServer.FLOOR(product.ListPrice)) "; - - queryString = @"ANYELEMENT(SELECT VALUE SqlServer.COUNT_BIG(product.ProductID) - FROM AdventureWorksEntities.Products AS product - WHERE SqlServer.CEILING(product.ListPrice) == + + queryString = @"ANYELEMENT(SELECT VALUE SqlServer.COUNT_BIG(product.ProductID) + FROM AdventureWorksEntities.Products AS product + WHERE SqlServer.CEILING(product.ListPrice) == SqlServer.FLOOR(product.ListPrice)) "; - queryString = @"SELECT VALUE SqlServer.MAX(p.ListPrice) + queryString = @"SELECT VALUE SqlServer.MAX(p.ListPrice) FROM AdventureWorksEntities.Products as p"; - queryString = @"SELECT VALUE SqlServer.MIN(p.ListPrice) + queryString = @"SELECT VALUE SqlServer.MIN(p.ListPrice) FROM AdventureWorksEntities.Products as p"; - queryString = @"SELECT VALUE SqlServer.STDEV(product.ListPrice) - FROM AdventureWorksEntities.Products AS product + queryString = @"SELECT VALUE SqlServer.STDEV(product.ListPrice) + FROM AdventureWorksEntities.Products AS product WHERE product.ListPrice > cast(@price as Decimal) "; pc.Add("price", 20); TestProduct(queryString, pc); pc.Clear(); - queryString = @"SELECT VALUE SqlServer.STDEVP(product.ListPrice) - FROM AdventureWorksEntities.Products AS product + queryString = @"SELECT VALUE SqlServer.STDEVP(product.ListPrice) + FROM AdventureWorksEntities.Products AS product WHERE product.ListPrice > cast(@price as Decimal) "; pc.Add("price", 20); TestProduct(queryString, pc); pc.Clear(); - queryString = @"SELECT VALUE SqlServer.SUM(p.ListPrice) + queryString = @"SELECT VALUE SqlServer.SUM(p.ListPrice) FROM AdventureWorksEntities.Products as p"; - queryString = @"SELECT VALUE SqlServer.VAR(product.ListPrice) - FROM AdventureWorksEntities.Products AS product + queryString = @"SELECT VALUE SqlServer.VAR(product.ListPrice) + FROM AdventureWorksEntities.Products AS product WHERE product.ListPrice > cast(@price as Decimal)"; pc.Add("price", 20); TestProduct(queryString, pc); pc.Clear(); - queryString = @"SELECT VALUE SqlServer.VARP(product.ListPrice) - FROM AdventureWorksEntities.Products AS product + queryString = @"SELECT VALUE SqlServer.VARP(product.ListPrice) + FROM AdventureWorksEntities.Products AS product WHERE product.ListPrice > cast(@price as Decimal) "; pc.Add("price", 20); TestProduct(queryString, pc); pc.Clear(); - queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products - AS product WHERE product.ListPrice == + queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products + AS product WHERE product.ListPrice == SqlServer.CEILING(product.ListPrice) "; - queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products - AS product WHERE product.ListPrice == + queryString = @"SELECT VALUE product FROM AdventureWorksEntities.Products + AS product WHERE product.ListPrice == SqlServer.FLOOR(product.ListPrice) "; /* // @@ -825,8 +825,8 @@ Function MyAvg(dues Collection(Decimal)) AS ( Avg(select value due from dues as due where due > @price) ) - SELECT TOP(10) contactID, MyAvg(GroupPartition(order.TotalDue)) - FROM AdventureWorksEntities.SalesOrderHeaders AS order + SELECT TOP(10) contactID, MyAvg(GroupPartition(order.TotalDue)) + FROM AdventureWorksEntities.SalesOrderHeaders AS order GROUP BY order.Contact.ContactID as contactID; // */ @@ -835,9 +835,9 @@ Function MyAvg(dues Collection(Decimal)) AS ( Avg(SELECT VALUE due FROM dues as due WHERE due > @price) ) - SELECT TOP(10) contactID, MyAvg(GroupPartition(order.TotalDue)) - FROM AdventureWorksEntities.SalesOrderHeaders - AS order + SELECT TOP(10) contactID, MyAvg(GroupPartition(order.TotalDue)) + FROM AdventureWorksEntities.SalesOrderHeaders + AS order GROUP BY order.Contact.ContactID as contactID; "; pc.Add("price", 20); @@ -867,7 +867,7 @@ static void TestProduct(string esqlQuery, Dictionary parametes) using (EntityDataReader rdr = cmd.ExecuteReader(CommandBehavior.SequentialAccess)) { - // The result returned by this query contains + // The result returned by this query contains // Address complex Types. while (rdr.Read()) { diff --git a/samples/snippets/csharp/VS_Snippets_Data/dp entityservices concepts/cs/schoolmodel.designer.cs b/samples/snippets/csharp/VS_Snippets_Data/dp entityservices concepts/cs/schoolmodel.designer.cs index 9adbecb2affc1..a38a4603c6c0c 100644 --- a/samples/snippets/csharp/VS_Snippets_Data/dp entityservices concepts/cs/schoolmodel.designer.cs +++ b/samples/snippets/csharp/VS_Snippets_Data/dp entityservices concepts/cs/schoolmodel.designer.cs @@ -41,7 +41,7 @@ public SchoolEntities() : base("name=SchoolEntities", "SchoolEntities") { OnContextCreated(); } - + /// /// Initialize a new SchoolEntities object. /// @@ -49,7 +49,7 @@ public SchoolEntities(string connectionString) : base(connectionString, "SchoolE { OnContextCreated(); } - + /// /// Initialize a new SchoolEntities object. /// @@ -58,11 +58,11 @@ public SchoolEntities(EntityConnection connection) : base(connection, "SchoolEnt OnContextCreated(); } #endregion - + #region Partial Methods partial void OnContextCreated(); #endregion - + #region ObjectSet Properties /// /// No Metadata Documentation available. @@ -79,7 +79,7 @@ public ObjectSet Courses } } private ObjectSet _Courses; - + /// /// No Metadata Documentation available. /// @@ -95,7 +95,7 @@ public ObjectSet Departments } } private ObjectSet _Departments; - + /// /// No Metadata Documentation available. /// @@ -111,7 +111,7 @@ public ObjectSet OfficeAssignments } } private ObjectSet _OfficeAssignments; - + /// /// No Metadata Documentation available. /// @@ -127,7 +127,7 @@ public ObjectSet People } } private ObjectSet _People; - + /// /// No Metadata Documentation available. /// @@ -143,10 +143,10 @@ public ObjectSet StudentGrades } } private ObjectSet _StudentGrades; - + #endregion #region AddTo Methods - + /// /// Deprecated Method for adding a new object to the Courses EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// @@ -154,7 +154,7 @@ public void AddToCourses(Course course) { base.AddObject("Courses", course); } - + /// /// Deprecated Method for adding a new object to the Departments EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// @@ -162,7 +162,7 @@ public void AddToDepartments(Department department) { base.AddObject("Departments", department); } - + /// /// Deprecated Method for adding a new object to the OfficeAssignments EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// @@ -170,7 +170,7 @@ public void AddToOfficeAssignments(OfficeAssignment officeAssignment) { base.AddObject("OfficeAssignments", officeAssignment); } - + /// /// Deprecated Method for adding a new object to the People EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// @@ -178,7 +178,7 @@ public void AddToPeople(Person person) { base.AddObject("People", person); } - + /// /// Deprecated Method for adding a new object to the StudentGrades EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// @@ -188,14 +188,14 @@ public void AddToStudentGrades(StudentGrade studentGrade) } #endregion #region Function Imports - + /// /// No Metadata Documentation available. /// /// No Metadata Documentation available. public ObjectResult GetStudentGrades(Nullable studentID) { - + ObjectParameter studentIDParameter; if (studentID.HasValue) { @@ -207,15 +207,15 @@ public ObjectResult GetStudentGrades(Nullable("GetStudentGrades", studentIDParameter); } - + /// - /// No Metadata Documentation available. + /// No Metadata Documentation available. /// /// /// No Metadata Documentation available. public ObjectResult GetStudentGrades(Nullable studentID, MergeOption mergeOption) { - + ObjectParameter studentIDParameter; if (studentID.HasValue) { @@ -229,10 +229,10 @@ public ObjectResult GetStudentGrades(Nullable /// No Metadata Documentation available. @@ -267,12 +267,12 @@ public abstract partial class Course : EntityObject OnCourseIDChanged(); } } - + } private global::System.Int32 _CourseID; partial void OnCourseIDChanging(global::System.Int32 value); partial void OnCourseIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -292,12 +292,12 @@ public abstract partial class Course : EntityObject ReportPropertyChanged("Title"); OnTitleChanged(); } - + } private global::System.String _Title; partial void OnTitleChanging(global::System.String value); partial void OnTitleChanged(); - + /// /// No Metadata Documentation available. /// @@ -317,12 +317,12 @@ public abstract partial class Course : EntityObject ReportPropertyChanged("Credits"); OnCreditsChanged(); } - + } private global::System.Int32 _Credits; partial void OnCreditsChanging(global::System.Int32 value); partial void OnCreditsChanged(); - + /// /// No Metadata Documentation available. /// @@ -342,14 +342,14 @@ public abstract partial class Course : EntityObject ReportPropertyChanged("DepartmentID"); OnDepartmentIDChanged(); } - + } private global::System.Int32 _DepartmentID; partial void OnDepartmentIDChanging(global::System.Int32 value); partial void OnDepartmentIDChanged(); - + #endregion - + #region Navigation Properties /// /// No Metadata Documentation available. @@ -357,7 +357,7 @@ public abstract partial class Course : EntityObject [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "FK_Course_Department", "Department")] + [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "FK_Course_Department", "Department")] public Department Department { get @@ -394,7 +394,7 @@ public EntityReference DepartmentReference [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "FK_StudentGrade_Course", "StudentGrade")] + [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "FK_StudentGrade_Course", "StudentGrade")] public EntityCollection StudentGrades { get @@ -415,7 +415,7 @@ public EntityCollection StudentGrades [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "CourseInstructor", "Person")] + [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "CourseInstructor", "Person")] public EntityCollection People { get @@ -432,7 +432,7 @@ public EntityCollection People } #endregion } - + /// /// No Metadata Documentation available. /// @@ -453,13 +453,13 @@ public static Department CreateDepartment(global::System.Int32 departmentID, glo { Department department = new Department(); department.DepartmentID = departmentID; - + department.Name = name; - + department.Budget = budget; - + department.StartDate = startDate; - + return department; } #endregion @@ -487,12 +487,12 @@ public static Department CreateDepartment(global::System.Int32 departmentID, glo OnDepartmentIDChanged(); } } - + } private global::System.Int32 _DepartmentID; partial void OnDepartmentIDChanging(global::System.Int32 value); partial void OnDepartmentIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -512,12 +512,12 @@ public static Department CreateDepartment(global::System.Int32 departmentID, glo ReportPropertyChanged("Name"); OnNameChanged(); } - + } private global::System.String _Name; partial void OnNameChanging(global::System.String value); partial void OnNameChanged(); - + /// /// No Metadata Documentation available. /// @@ -537,12 +537,12 @@ public static Department CreateDepartment(global::System.Int32 departmentID, glo ReportPropertyChanged("Budget"); OnBudgetChanged(); } - + } private global::System.Decimal _Budget; partial void OnBudgetChanging(global::System.Decimal value); partial void OnBudgetChanged(); - + /// /// No Metadata Documentation available. /// @@ -562,12 +562,12 @@ public static Department CreateDepartment(global::System.Int32 departmentID, glo ReportPropertyChanged("StartDate"); OnStartDateChanged(); } - + } private global::System.DateTime _StartDate; partial void OnStartDateChanging(global::System.DateTime value); partial void OnStartDateChanged(); - + /// /// No Metadata Documentation available. /// @@ -587,14 +587,14 @@ public static Department CreateDepartment(global::System.Int32 departmentID, glo ReportPropertyChanged("Administrator"); OnAdministratorChanged(); } - + } private Nullable _Administrator; partial void OnAdministratorChanging(Nullable value); partial void OnAdministratorChanged(); - + #endregion - + #region Navigation Properties /// /// No Metadata Documentation available. @@ -602,7 +602,7 @@ public static Department CreateDepartment(global::System.Int32 departmentID, glo [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "FK_Course_Department", "Course")] + [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "FK_Course_Department", "Course")] public EntityCollection Courses { get @@ -619,7 +619,7 @@ public EntityCollection Courses } #endregion } - + /// /// No Metadata Documentation available. /// @@ -639,11 +639,11 @@ public static OfficeAssignment CreateOfficeAssignment(global::System.Int32 instr { OfficeAssignment officeAssignment = new OfficeAssignment(); officeAssignment.InstructorID = instructorID; - + officeAssignment.Location = location; - + officeAssignment.Timestamp = timestamp; - + return officeAssignment; } #endregion @@ -671,12 +671,12 @@ public static OfficeAssignment CreateOfficeAssignment(global::System.Int32 instr OnInstructorIDChanged(); } } - + } private global::System.Int32 _InstructorID; partial void OnInstructorIDChanging(global::System.Int32 value); partial void OnInstructorIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -696,12 +696,12 @@ public static OfficeAssignment CreateOfficeAssignment(global::System.Int32 instr ReportPropertyChanged("Location"); OnLocationChanged(); } - + } private global::System.String _Location; partial void OnLocationChanging(global::System.String value); partial void OnLocationChanged(); - + /// /// No Metadata Documentation available. /// @@ -721,14 +721,14 @@ public static OfficeAssignment CreateOfficeAssignment(global::System.Int32 instr ReportPropertyChanged("Timestamp"); OnTimestampChanged(); } - + } private global::System.Byte[] _Timestamp; partial void OnTimestampChanging(global::System.Byte[] value); partial void OnTimestampChanged(); - + #endregion - + #region Navigation Properties /// /// No Metadata Documentation available. @@ -736,7 +736,7 @@ public static OfficeAssignment CreateOfficeAssignment(global::System.Int32 instr [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "FK_OfficeAssignment_Person", "Person")] + [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "FK_OfficeAssignment_Person", "Person")] public Person Person { get @@ -769,7 +769,7 @@ public EntityReference PersonReference } #endregion } - + /// /// No Metadata Documentation available. /// @@ -791,15 +791,15 @@ public static OnlineCourse CreateOnlineCourse(global::System.Int32 courseID, glo { OnlineCourse onlineCourse = new OnlineCourse(); onlineCourse.CourseID = courseID; - + onlineCourse.Title = title; - + onlineCourse.Credits = credits; - + onlineCourse.DepartmentID = departmentID; - + onlineCourse.URL = uRL; - + return onlineCourse; } #endregion @@ -824,16 +824,16 @@ public static OnlineCourse CreateOnlineCourse(global::System.Int32 courseID, glo ReportPropertyChanged("URL"); OnURLChanged(); } - + } private global::System.String _URL; partial void OnURLChanging(global::System.String value); partial void OnURLChanged(); - + #endregion - + } - + /// /// No Metadata Documentation available. /// @@ -857,19 +857,19 @@ public static OnsiteCourse CreateOnsiteCourse(global::System.Int32 courseID, glo { OnsiteCourse onsiteCourse = new OnsiteCourse(); onsiteCourse.CourseID = courseID; - + onsiteCourse.Title = title; - + onsiteCourse.Credits = credits; - + onsiteCourse.DepartmentID = departmentID; - + onsiteCourse.Location = location; - + onsiteCourse.Days = days; - + onsiteCourse.Time = time; - + return onsiteCourse; } #endregion @@ -894,12 +894,12 @@ public static OnsiteCourse CreateOnsiteCourse(global::System.Int32 courseID, glo ReportPropertyChanged("Location"); OnLocationChanged(); } - + } private global::System.String _Location; partial void OnLocationChanging(global::System.String value); partial void OnLocationChanged(); - + /// /// No Metadata Documentation available. /// @@ -919,12 +919,12 @@ public static OnsiteCourse CreateOnsiteCourse(global::System.Int32 courseID, glo ReportPropertyChanged("Days"); OnDaysChanged(); } - + } private global::System.String _Days; partial void OnDaysChanging(global::System.String value); partial void OnDaysChanged(); - + /// /// No Metadata Documentation available. /// @@ -944,16 +944,16 @@ public static OnsiteCourse CreateOnsiteCourse(global::System.Int32 courseID, glo ReportPropertyChanged("Time"); OnTimeChanged(); } - + } private global::System.DateTime _Time; partial void OnTimeChanging(global::System.DateTime value); partial void OnTimeChanged(); - + #endregion - + } - + /// /// No Metadata Documentation available. /// @@ -973,11 +973,11 @@ public static Person CreatePerson(global::System.Int32 personID, global::System. { Person person = new Person(); person.PersonID = personID; - + person.LastName = lastName; - + person.FirstName = firstName; - + return person; } #endregion @@ -1005,12 +1005,12 @@ public static Person CreatePerson(global::System.Int32 personID, global::System. OnPersonIDChanged(); } } - + } private global::System.Int32 _PersonID; partial void OnPersonIDChanging(global::System.Int32 value); partial void OnPersonIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1030,12 +1030,12 @@ public static Person CreatePerson(global::System.Int32 personID, global::System. ReportPropertyChanged("LastName"); OnLastNameChanged(); } - + } private global::System.String _LastName; partial void OnLastNameChanging(global::System.String value); partial void OnLastNameChanged(); - + /// /// No Metadata Documentation available. /// @@ -1055,12 +1055,12 @@ public static Person CreatePerson(global::System.Int32 personID, global::System. ReportPropertyChanged("FirstName"); OnFirstNameChanged(); } - + } private global::System.String _FirstName; partial void OnFirstNameChanging(global::System.String value); partial void OnFirstNameChanged(); - + /// /// No Metadata Documentation available. /// @@ -1080,12 +1080,12 @@ public static Person CreatePerson(global::System.Int32 personID, global::System. ReportPropertyChanged("HireDate"); OnHireDateChanged(); } - + } private Nullable _HireDate; partial void OnHireDateChanging(Nullable value); partial void OnHireDateChanged(); - + /// /// No Metadata Documentation available. /// @@ -1105,14 +1105,14 @@ public static Person CreatePerson(global::System.Int32 personID, global::System. ReportPropertyChanged("EnrollmentDate"); OnEnrollmentDateChanged(); } - + } private Nullable _EnrollmentDate; partial void OnEnrollmentDateChanging(Nullable value); partial void OnEnrollmentDateChanged(); - + #endregion - + #region Navigation Properties /// /// No Metadata Documentation available. @@ -1120,7 +1120,7 @@ public static Person CreatePerson(global::System.Int32 personID, global::System. [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "FK_OfficeAssignment_Person", "OfficeAssignment")] + [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "FK_OfficeAssignment_Person", "OfficeAssignment")] public OfficeAssignment OfficeAssignment { get @@ -1157,7 +1157,7 @@ public EntityReference OfficeAssignmentReference [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "FK_StudentGrade_Student", "StudentGrade")] + [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "FK_StudentGrade_Student", "StudentGrade")] public EntityCollection StudentGrades { get @@ -1178,7 +1178,7 @@ public EntityCollection StudentGrades [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "CourseInstructor", "Course")] + [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "CourseInstructor", "Course")] public EntityCollection Courses { get @@ -1195,7 +1195,7 @@ public EntityCollection Courses } #endregion } - + /// /// No Metadata Documentation available. /// @@ -1215,11 +1215,11 @@ public static StudentGrade CreateStudentGrade(global::System.Int32 enrollmentID, { StudentGrade studentGrade = new StudentGrade(); studentGrade.EnrollmentID = enrollmentID; - + studentGrade.CourseID = courseID; - + studentGrade.StudentID = studentID; - + return studentGrade; } #endregion @@ -1247,12 +1247,12 @@ public static StudentGrade CreateStudentGrade(global::System.Int32 enrollmentID, OnEnrollmentIDChanged(); } } - + } private global::System.Int32 _EnrollmentID; partial void OnEnrollmentIDChanging(global::System.Int32 value); partial void OnEnrollmentIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1272,12 +1272,12 @@ public static StudentGrade CreateStudentGrade(global::System.Int32 enrollmentID, ReportPropertyChanged("CourseID"); OnCourseIDChanged(); } - + } private global::System.Int32 _CourseID; partial void OnCourseIDChanging(global::System.Int32 value); partial void OnCourseIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1297,12 +1297,12 @@ public static StudentGrade CreateStudentGrade(global::System.Int32 enrollmentID, ReportPropertyChanged("StudentID"); OnStudentIDChanged(); } - + } private global::System.Int32 _StudentID; partial void OnStudentIDChanging(global::System.Int32 value); partial void OnStudentIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1322,14 +1322,14 @@ public static StudentGrade CreateStudentGrade(global::System.Int32 enrollmentID, ReportPropertyChanged("Grade"); OnGradeChanged(); } - + } private Nullable _Grade; partial void OnGradeChanging(Nullable value); partial void OnGradeChanged(); - + #endregion - + #region Navigation Properties /// /// No Metadata Documentation available. @@ -1337,7 +1337,7 @@ public static StudentGrade CreateStudentGrade(global::System.Int32 enrollmentID, [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "FK_StudentGrade_Course", "Course")] + [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "FK_StudentGrade_Course", "Course")] public Course Course { get @@ -1374,7 +1374,7 @@ public EntityReference CourseReference [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "FK_StudentGrade_Student", "Person")] + [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "FK_StudentGrade_Student", "Person")] public Person Person { get @@ -1407,7 +1407,7 @@ public EntityReference PersonReference } #endregion } - + #endregion - + } diff --git a/samples/snippets/csharp/VS_Snippets_Data/dp entityservices concepts/cs/source.cs b/samples/snippets/csharp/VS_Snippets_Data/dp entityservices concepts/cs/source.cs index e79560d9952b5..802ac6f234825 100644 --- a/samples/snippets/csharp/VS_Snippets_Data/dp entityservices concepts/cs/source.cs +++ b/samples/snippets/csharp/VS_Snippets_Data/dp entityservices concepts/cs/source.cs @@ -28,8 +28,8 @@ public static void GroupByPartition() new AdventureWorksEntities()) { // Query that returns average TotalDue for a contact. - string queryString = @"SELECT TOP(@number1) contactID, AVG(GroupPartition(order.TotalDue)) - FROM AdventureWorksEntities.SalesOrderHeaders + string queryString = @"SELECT TOP(@number1) contactID, AVG(GroupPartition(order.TotalDue)) + FROM AdventureWorksEntities.SalesOrderHeaders AS order GROUP BY order.Contact.ContactID as contactID"; ObjectQuery query1 = new ObjectQuery(queryString, context); @@ -41,8 +41,8 @@ FROM AdventureWorksEntities.SalesOrderHeaders rec[0], rec[1]); } - queryString = @"SELECT TOP(@number2) contactID, AVG(order.TotalDue) - FROM AdventureWorksEntities.SalesOrderHeaders + queryString = @"SELECT TOP(@number2) contactID, AVG(order.TotalDue) + FROM AdventureWorksEntities.SalesOrderHeaders AS order GROUP BY order.Contact.ContactID as contactID"; ObjectQuery query2 = new ObjectQuery(queryString, context); query2.Parameters.Add(new ObjectParameter("number2", 10)); @@ -78,7 +78,7 @@ FROM AdventureWorksEntities.SalesOrderHeaders AS [order] foreach (DbDataRecord rec in query) { - Console.WriteLine("Order Total: Current - {0}, Calculated - {1}.", + Console.WriteLine("Order Total: Current - {0}, Calculated - {1}.", rec[0], rec[1]); } } @@ -90,11 +90,11 @@ static public void PolymorphicQuery() using (EntityConnection conn = new EntityConnection("name=SchoolEntities")) { conn.Open(); - // Create a query that specifies to + // Create a query that specifies to // get a collection of only OnsiteCourses. - string esqlQuery = @"SELECT VAlUE onsiteCourse FROM - OFTYPE(SchoolEntities.Courses, SchoolModel.OnsiteCourse) + string esqlQuery = @"SELECT VAlUE onsiteCourse FROM + OFTYPE(SchoolEntities.Courses, SchoolModel.OnsiteCourse) AS onsiteCourse"; using (EntityCommand cmd = new EntityCommand(esqlQuery, conn)) { @@ -123,7 +123,7 @@ static public void Transactions() EntityTransaction transaction = con.BeginTransaction(); DbCommand cmd = con.CreateCommand(); cmd.Transaction = transaction; - cmd.CommandText = @"SELECT VALUE Contact FROM AdventureWorksEntities.Contacts + cmd.CommandText = @"SELECT VALUE Contact FROM AdventureWorksEntities.Contacts AS Contact WHERE Contact.LastName = @ln"; EntityParameter param = new EntityParameter(); param.ParameterName = "ln"; @@ -153,7 +153,7 @@ static public void ComplexTypeWithEntityCommand() conn.Open(); string esqlQuery = @"SELECT VALUE contacts FROM - AdventureWorksEntities.Contacts AS contacts + AdventureWorksEntities.Contacts AS contacts WHERE contacts.ContactID == @id"; // Create an EntityCommand. @@ -169,7 +169,7 @@ AdventureWorksEntities.Contacts AS contacts using (EntityDataReader rdr = cmd.ExecuteReader(CommandBehavior.SequentialAccess)) { - // The result returned by this query contains + // The result returned by this query contains // Address complex Types. while (rdr.Read()) { @@ -283,14 +283,14 @@ static public void ParameterizedQueryWithEntityCommand() conn.Open(); // Create a query that takes two parameters. string esqlQuery = - @"SELECT VALUE Contact FROM AdventureWorksEntities.Contacts + @"SELECT VALUE Contact FROM AdventureWorksEntities.Contacts AS Contact WHERE Contact.LastName = @ln AND Contact.FirstName = @fn"; using (EntityCommand cmd = new EntityCommand(esqlQuery, conn)) { - // Create two parameters and add them to - // the EntityCommand's Parameters collection + // Create two parameters and add them to + // the EntityCommand's Parameters collection EntityParameter param1 = new EntityParameter(); param1.ParameterName = "ln"; param1.Value = "Adams"; @@ -328,8 +328,8 @@ static public void NavigateWithNavOperatorWithEntityCommand() { // Create an Entity SQL query. string esqlQuery = - @"SELECT address.AddressID, (SELECT VALUE DEREF(soh) FROM - NAVIGATE(address, AdventureWorksModel.FK_SalesOrderHeader_Address_BillToAddressID) + @"SELECT address.AddressID, (SELECT VALUE DEREF(soh) FROM + NAVIGATE(address, AdventureWorksModel.FK_SalesOrderHeader_Address_BillToAddressID) AS soh) FROM AdventureWorksEntities.Addresses AS address"; cmd.CommandText = esqlQuery; @@ -369,7 +369,7 @@ static public void ReturnNestedCollectionWithEntityCommand() using (EntityDataReader rdr = cmd.ExecuteReader(CommandBehavior.SequentialAccess)) { - // The result returned by this query contains + // The result returned by this query contains // ContactID and a nested collection of SalesOrderHeader items. // associated with this Contact. while (rdr.Read()) @@ -377,7 +377,7 @@ static public void ReturnNestedCollectionWithEntityCommand() // the first column contains Contact ID. Console.WriteLine("Contact ID: {0}", rdr["ContactID"]); - // The second column contains a collection of SalesOrderHeader + // The second column contains a collection of SalesOrderHeader // items associated with the Contact. DbDataReader nestedReader = rdr.GetDataReader(1); while (nestedReader.Read()) @@ -422,7 +422,7 @@ static public void ParameterizedQueryWithObjectQuery() { // Create a query that takes two parameters. string queryString = - @"SELECT VALUE Contact FROM AdventureWorksEntities.Contacts + @"SELECT VALUE Contact FROM AdventureWorksEntities.Contacts AS Contact WHERE Contact.LastName = @ln AND Contact.FirstName = @fn"; @@ -447,7 +447,7 @@ static public void NavRelationshipWithNavProperties() using (AdventureWorksEntities context = new AdventureWorksEntities()) { - string esqlQuery = @"SELECT c.FirstName, c.SalesOrderHeaders + string esqlQuery = @"SELECT c.FirstName, c.SalesOrderHeaders FROM AdventureWorksEntities.Contacts AS c where c.LastName = @ln"; ObjectQuery query = new ObjectQuery(esqlQuery, context); query.Parameters.Add(new ObjectParameter("ln", "Zhou")); @@ -458,7 +458,7 @@ static public void NavRelationshipWithNavProperties() // Display contact's first name. Console.WriteLine("First Name {0}: ", rec[0]); List list = rec[1] as List; - // Display SalesOrderHeader information + // Display SalesOrderHeader information // associated with the contact. foreach (SalesOrderHeader soh in list) { @@ -476,7 +476,7 @@ static public void ReturnAnonymousTypeWithObjectQuery() using (AdventureWorksEntities context = new AdventureWorksEntities()) { - string myQuery = @"SELECT p.ProductID, p.Name FROM + string myQuery = @"SELECT p.ProductID, p.Name FROM AdventureWorksEntities.Products as p"; foreach (DbDataRecord rec in @@ -494,7 +494,7 @@ static public void ReturnPrimitiveTypeWithObjectQuery() using (AdventureWorksEntities context = new AdventureWorksEntities()) { - string queryString = @"SELECT VALUE Length(p.Name)FROM + string queryString = @"SELECT VALUE Length(p.Name)FROM AdventureWorksEntities.Products AS p"; ObjectQuery productQuery = @@ -510,10 +510,10 @@ static public void GroupDataWithObjectQuery() using (AdventureWorksEntities context = new AdventureWorksEntities()) { - string esqlQuery = @"SELECT ln, - (SELECT c1.LastName FROM AdventureWorksEntities.Contacts - AS c1 WHERE SUBSTRING(c1.LastName ,1,1) = ln) - AS CONTACT + string esqlQuery = @"SELECT ln, + (SELECT c1.LastName FROM AdventureWorksEntities.Contacts + AS c1 WHERE SUBSTRING(c1.LastName ,1,1) = ln) + AS CONTACT FROM AdventureWorksEntities.Contacts AS c2 GROUP BY SUBSTRING(c2.LastName ,1,1) AS ln ORDER BY ln"; @@ -542,8 +542,8 @@ static public void AggregateDataWithObjectQuery() using (AdventureWorksEntities context = new AdventureWorksEntities()) { - string esqlQuery = @"SELECT contactID, AVG(order.TotalDue) - FROM AdventureWorksEntities.SalesOrderHeaders + string esqlQuery = @"SELECT contactID, AVG(order.TotalDue) + FROM AdventureWorksEntities.SalesOrderHeaders AS order GROUP BY order.Contact.ContactID as contactID"; foreach (DbDataRecord rec in @@ -563,11 +563,11 @@ static public void OrderTwoUnionizedQueriesWithObjectQuery() new AdventureWorksEntities()) { String esqlQuery = @"SELECT P2.Name, P2.ListPrice - FROM ((SELECT P1.Name, P1.ProductID as Pid, P1.ListPrice + FROM ((SELECT P1.Name, P1.ProductID as Pid, P1.ListPrice FROM AdventureWorksEntities.Products as P1 where P1.Name like 'A%') union all - (SELECT P1.Name, P1.ProductID as Pid, P1.ListPrice + (SELECT P1.Name, P1.ProductID as Pid, P1.ListPrice FROM AdventureWorksEntities.Products as P1 WHERE P1.Name like 'B%') ) as P2 @@ -590,8 +590,8 @@ static public void ESQLPagingWithObjectQuery() { // Create a query that takes two parameters. string queryString = - @"SELECT VALUE product FROM - AdventureWorksEntities.Products AS product + @"SELECT VALUE product FROM + AdventureWorksEntities.Products AS product order by product.ListPrice SKIP @skip LIMIT @limit"; ObjectQuery productQuery = @@ -657,7 +657,7 @@ static void StructuralTypeVisitRecord(IExtendedDataRecord record) BuiltInTypeKind fieldTypeKind = record.DataRecordInfo.FieldMetadata[fieldIndex]. FieldType.TypeUsage.EdmType.BuiltInTypeKind; // The EntityType, ComplexType and RowType are structural types - // that have members. + // that have members. // Read only the PrimitiveType members of this structural type. if (fieldTypeKind == BuiltInTypeKind.PrimitiveType) { @@ -717,7 +717,7 @@ static void RefTypeVisitRecord(IExtendedDataRecord record) //read only fields that contain PrimitiveType if (fieldTypeKind == BuiltInTypeKind.RefType) { - // Ref types are surfaced as EntityKey instances. + // Ref types are surfaced as EntityKey instances. // The containing record sees them as atomic. EntityKey key = record.GetValue(fieldIndex) as EntityKey; // Get the EntitySet name. @@ -760,7 +760,7 @@ static void ExecutePrimitiveTypeQuery(string esqlQuery) while (rdr.Read()) { IExtendedDataRecord record = rdr as IExtendedDataRecord; - // For PrimitiveType + // For PrimitiveType // the record contains exactly one field. int fieldIndex = 0; Console.WriteLine("Value: " + record.GetValue(fieldIndex)); diff --git a/samples/snippets/csharp/VS_Snippets_Data/dp l2e arraysandlistsinqueries/cs/adventureworksmodel.designer.cs b/samples/snippets/csharp/VS_Snippets_Data/dp l2e arraysandlistsinqueries/cs/adventureworksmodel.designer.cs index 4bba7a14bd4d1..e75f8f1a88ef8 100644 --- a/samples/snippets/csharp/VS_Snippets_Data/dp l2e arraysandlistsinqueries/cs/adventureworksmodel.designer.cs +++ b/samples/snippets/csharp/VS_Snippets_Data/dp l2e arraysandlistsinqueries/cs/adventureworksmodel.designer.cs @@ -40,7 +40,7 @@ public AdventureWorksEntities() : base("name=AdventureWorksEntities", "Adventure { OnContextCreated(); } - + /// /// Initialize a new AdventureWorksEntities object. /// @@ -48,7 +48,7 @@ public AdventureWorksEntities(string connectionString) : base(connectionString, { OnContextCreated(); } - + /// /// Initialize a new AdventureWorksEntities object. /// @@ -57,11 +57,11 @@ public AdventureWorksEntities(EntityConnection connection) : base(connection, "A OnContextCreated(); } #endregion - + #region Partial Methods partial void OnContextCreated(); #endregion - + #region ObjectSet Properties /// /// No Metadata Documentation available. @@ -78,7 +78,7 @@ public ObjectSet
Addresses } } private ObjectSet
_Addresses; - + /// /// No Metadata Documentation available. /// @@ -94,7 +94,7 @@ public ObjectSet Contacts } } private ObjectSet _Contacts; - + /// /// No Metadata Documentation available. /// @@ -110,7 +110,7 @@ public ObjectSet Products } } private ObjectSet _Products; - + /// /// No Metadata Documentation available. /// @@ -126,7 +126,7 @@ public ObjectSet SalesOrderDetails } } private ObjectSet _SalesOrderDetails; - + /// /// No Metadata Documentation available. /// @@ -142,10 +142,10 @@ public ObjectSet SalesOrderHeaders } } private ObjectSet _SalesOrderHeaders; - + #endregion #region AddTo Methods - + /// /// Deprecated Method for adding a new object to the Addresses EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// @@ -153,7 +153,7 @@ public void AddToAddresses(Address address) { base.AddObject("Addresses", address); } - + /// /// Deprecated Method for adding a new object to the Contacts EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// @@ -161,7 +161,7 @@ public void AddToContacts(Contact contact) { base.AddObject("Contacts", contact); } - + /// /// Deprecated Method for adding a new object to the Products EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// @@ -169,7 +169,7 @@ public void AddToProducts(Product product) { base.AddObject("Products", product); } - + /// /// Deprecated Method for adding a new object to the SalesOrderDetails EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// @@ -177,7 +177,7 @@ public void AddToSalesOrderDetails(SalesOrderDetail salesOrderDetail) { base.AddObject("SalesOrderDetails", salesOrderDetail); } - + /// /// Deprecated Method for adding a new object to the SalesOrderHeaders EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// @@ -187,10 +187,10 @@ public void AddToSalesOrderHeaders(SalesOrderHeader salesOrderHeader) } #endregion } - + #endregion - - + + #region Entities /// /// No Metadata Documentation available. @@ -215,19 +215,19 @@ public static Address CreateAddress(global::System.Int32 addressID, global::Syst { Address address = new Address(); address.AddressID = addressID; - + address.AddressLine1 = addressLine1; - + address.City = city; - + address.StateProvinceID = stateProvinceID; - + address.PostalCode = postalCode; - + address.rowguid = rowguid; - + address.ModifiedDate = modifiedDate; - + return address; } #endregion @@ -255,12 +255,12 @@ public static Address CreateAddress(global::System.Int32 addressID, global::Syst OnAddressIDChanged(); } } - + } private global::System.Int32 _AddressID; partial void OnAddressIDChanging(global::System.Int32 value); partial void OnAddressIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -280,12 +280,12 @@ public static Address CreateAddress(global::System.Int32 addressID, global::Syst ReportPropertyChanged("AddressLine1"); OnAddressLine1Changed(); } - + } private global::System.String _AddressLine1; partial void OnAddressLine1Changing(global::System.String value); partial void OnAddressLine1Changed(); - + /// /// No Metadata Documentation available. /// @@ -305,12 +305,12 @@ public static Address CreateAddress(global::System.Int32 addressID, global::Syst ReportPropertyChanged("AddressLine2"); OnAddressLine2Changed(); } - + } private global::System.String _AddressLine2; partial void OnAddressLine2Changing(global::System.String value); partial void OnAddressLine2Changed(); - + /// /// No Metadata Documentation available. /// @@ -330,12 +330,12 @@ public static Address CreateAddress(global::System.Int32 addressID, global::Syst ReportPropertyChanged("City"); OnCityChanged(); } - + } private global::System.String _City; partial void OnCityChanging(global::System.String value); partial void OnCityChanged(); - + /// /// No Metadata Documentation available. /// @@ -355,12 +355,12 @@ public static Address CreateAddress(global::System.Int32 addressID, global::Syst ReportPropertyChanged("StateProvinceID"); OnStateProvinceIDChanged(); } - + } private global::System.Int32 _StateProvinceID; partial void OnStateProvinceIDChanging(global::System.Int32 value); partial void OnStateProvinceIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -380,12 +380,12 @@ public static Address CreateAddress(global::System.Int32 addressID, global::Syst ReportPropertyChanged("PostalCode"); OnPostalCodeChanged(); } - + } private global::System.String _PostalCode; partial void OnPostalCodeChanging(global::System.String value); partial void OnPostalCodeChanged(); - + /// /// No Metadata Documentation available. /// @@ -405,12 +405,12 @@ public static Address CreateAddress(global::System.Int32 addressID, global::Syst ReportPropertyChanged("rowguid"); OnrowguidChanged(); } - + } private global::System.Guid _rowguid; partial void OnrowguidChanging(global::System.Guid value); partial void OnrowguidChanged(); - + /// /// No Metadata Documentation available. /// @@ -430,14 +430,14 @@ public static Address CreateAddress(global::System.Int32 addressID, global::Syst ReportPropertyChanged("ModifiedDate"); OnModifiedDateChanged(); } - + } private global::System.DateTime _ModifiedDate; partial void OnModifiedDateChanging(global::System.DateTime value); partial void OnModifiedDateChanged(); - + #endregion - + #region Navigation Properties /// /// No Metadata Documentation available. @@ -445,7 +445,7 @@ public static Address CreateAddress(global::System.Int32 addressID, global::Syst [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Address_BillToAddressID", "SalesOrderHeader")] + [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Address_BillToAddressID", "SalesOrderHeader")] public EntityCollection SalesOrderHeaders { get @@ -466,7 +466,7 @@ public EntityCollection SalesOrderHeaders [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Address_ShipToAddressID", "SalesOrderHeader")] + [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Address_ShipToAddressID", "SalesOrderHeader")] public EntityCollection SalesOrderHeaders1 { get @@ -483,7 +483,7 @@ public EntityCollection SalesOrderHeaders1 } #endregion } - + /// /// No Metadata Documentation available. /// @@ -509,23 +509,23 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst { Contact contact = new Contact(); contact.ContactID = contactID; - + contact.NameStyle = nameStyle; - + contact.FirstName = firstName; - + contact.LastName = lastName; - + contact.EmailPromotion = emailPromotion; - + contact.PasswordHash = passwordHash; - + contact.PasswordSalt = passwordSalt; - + contact.rowguid = rowguid; - + contact.ModifiedDate = modifiedDate; - + return contact; } #endregion @@ -553,12 +553,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst OnContactIDChanged(); } } - + } private global::System.Int32 _ContactID; partial void OnContactIDChanging(global::System.Int32 value); partial void OnContactIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -578,12 +578,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("NameStyle"); OnNameStyleChanged(); } - + } private global::System.Boolean _NameStyle; partial void OnNameStyleChanging(global::System.Boolean value); partial void OnNameStyleChanged(); - + /// /// No Metadata Documentation available. /// @@ -603,12 +603,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("Title"); OnTitleChanged(); } - + } private global::System.String _Title; partial void OnTitleChanging(global::System.String value); partial void OnTitleChanged(); - + /// /// No Metadata Documentation available. /// @@ -628,12 +628,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("FirstName"); OnFirstNameChanged(); } - + } private global::System.String _FirstName; partial void OnFirstNameChanging(global::System.String value); partial void OnFirstNameChanged(); - + /// /// No Metadata Documentation available. /// @@ -653,12 +653,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("MiddleName"); OnMiddleNameChanged(); } - + } private global::System.String _MiddleName; partial void OnMiddleNameChanging(global::System.String value); partial void OnMiddleNameChanged(); - + /// /// No Metadata Documentation available. /// @@ -678,12 +678,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("LastName"); OnLastNameChanged(); } - + } private global::System.String _LastName; partial void OnLastNameChanging(global::System.String value); partial void OnLastNameChanged(); - + /// /// No Metadata Documentation available. /// @@ -703,12 +703,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("Suffix"); OnSuffixChanged(); } - + } private global::System.String _Suffix; partial void OnSuffixChanging(global::System.String value); partial void OnSuffixChanged(); - + /// /// No Metadata Documentation available. /// @@ -728,12 +728,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("EmailAddress"); OnEmailAddressChanged(); } - + } private global::System.String _EmailAddress; partial void OnEmailAddressChanging(global::System.String value); partial void OnEmailAddressChanged(); - + /// /// No Metadata Documentation available. /// @@ -753,12 +753,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("EmailPromotion"); OnEmailPromotionChanged(); } - + } private global::System.Int32 _EmailPromotion; partial void OnEmailPromotionChanging(global::System.Int32 value); partial void OnEmailPromotionChanged(); - + /// /// No Metadata Documentation available. /// @@ -778,12 +778,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("Phone"); OnPhoneChanged(); } - + } private global::System.String _Phone; partial void OnPhoneChanging(global::System.String value); partial void OnPhoneChanged(); - + /// /// No Metadata Documentation available. /// @@ -803,12 +803,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("PasswordHash"); OnPasswordHashChanged(); } - + } private global::System.String _PasswordHash; partial void OnPasswordHashChanging(global::System.String value); partial void OnPasswordHashChanged(); - + /// /// No Metadata Documentation available. /// @@ -828,12 +828,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("PasswordSalt"); OnPasswordSaltChanged(); } - + } private global::System.String _PasswordSalt; partial void OnPasswordSaltChanging(global::System.String value); partial void OnPasswordSaltChanged(); - + /// /// No Metadata Documentation available. /// @@ -853,12 +853,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("AdditionalContactInfo"); OnAdditionalContactInfoChanged(); } - + } private global::System.String _AdditionalContactInfo; partial void OnAdditionalContactInfoChanging(global::System.String value); partial void OnAdditionalContactInfoChanged(); - + /// /// No Metadata Documentation available. /// @@ -878,12 +878,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("rowguid"); OnrowguidChanged(); } - + } private global::System.Guid _rowguid; partial void OnrowguidChanging(global::System.Guid value); partial void OnrowguidChanged(); - + /// /// No Metadata Documentation available. /// @@ -903,14 +903,14 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("ModifiedDate"); OnModifiedDateChanged(); } - + } private global::System.DateTime _ModifiedDate; partial void OnModifiedDateChanging(global::System.DateTime value); partial void OnModifiedDateChanged(); - + #endregion - + #region Navigation Properties /// /// No Metadata Documentation available. @@ -918,7 +918,7 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Contact_ContactID", "SalesOrderHeader")] + [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Contact_ContactID", "SalesOrderHeader")] public EntityCollection SalesOrderHeaders { get @@ -935,7 +935,7 @@ public EntityCollection SalesOrderHeaders } #endregion } - + /// /// No Metadata Documentation available. /// @@ -965,31 +965,31 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst { Product product = new Product(); product.ProductID = productID; - + product.Name = name; - + product.ProductNumber = productNumber; - + product.MakeFlag = makeFlag; - + product.FinishedGoodsFlag = finishedGoodsFlag; - + product.SafetyStockLevel = safetyStockLevel; - + product.ReorderPoint = reorderPoint; - + product.StandardCost = standardCost; - + product.ListPrice = listPrice; - + product.DaysToManufacture = daysToManufacture; - + product.SellStartDate = sellStartDate; - + product.rowguid = rowguid; - + product.ModifiedDate = modifiedDate; - + return product; } #endregion @@ -1017,12 +1017,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst OnProductIDChanged(); } } - + } private global::System.Int32 _ProductID; partial void OnProductIDChanging(global::System.Int32 value); partial void OnProductIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1042,12 +1042,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("Name"); OnNameChanged(); } - + } private global::System.String _Name; partial void OnNameChanging(global::System.String value); partial void OnNameChanged(); - + /// /// No Metadata Documentation available. /// @@ -1067,12 +1067,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("ProductNumber"); OnProductNumberChanged(); } - + } private global::System.String _ProductNumber; partial void OnProductNumberChanging(global::System.String value); partial void OnProductNumberChanged(); - + /// /// No Metadata Documentation available. /// @@ -1092,12 +1092,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("MakeFlag"); OnMakeFlagChanged(); } - + } private global::System.Boolean _MakeFlag; partial void OnMakeFlagChanging(global::System.Boolean value); partial void OnMakeFlagChanged(); - + /// /// No Metadata Documentation available. /// @@ -1117,12 +1117,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("FinishedGoodsFlag"); OnFinishedGoodsFlagChanged(); } - + } private global::System.Boolean _FinishedGoodsFlag; partial void OnFinishedGoodsFlagChanging(global::System.Boolean value); partial void OnFinishedGoodsFlagChanged(); - + /// /// No Metadata Documentation available. /// @@ -1142,12 +1142,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("Color"); OnColorChanged(); } - + } private global::System.String _Color; partial void OnColorChanging(global::System.String value); partial void OnColorChanged(); - + /// /// No Metadata Documentation available. /// @@ -1167,12 +1167,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("SafetyStockLevel"); OnSafetyStockLevelChanged(); } - + } private global::System.Int16 _SafetyStockLevel; partial void OnSafetyStockLevelChanging(global::System.Int16 value); partial void OnSafetyStockLevelChanged(); - + /// /// No Metadata Documentation available. /// @@ -1192,12 +1192,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("ReorderPoint"); OnReorderPointChanged(); } - + } private global::System.Int16 _ReorderPoint; partial void OnReorderPointChanging(global::System.Int16 value); partial void OnReorderPointChanged(); - + /// /// No Metadata Documentation available. /// @@ -1217,12 +1217,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("StandardCost"); OnStandardCostChanged(); } - + } private global::System.Decimal _StandardCost; partial void OnStandardCostChanging(global::System.Decimal value); partial void OnStandardCostChanged(); - + /// /// No Metadata Documentation available. /// @@ -1242,12 +1242,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("ListPrice"); OnListPriceChanged(); } - + } private global::System.Decimal _ListPrice; partial void OnListPriceChanging(global::System.Decimal value); partial void OnListPriceChanged(); - + /// /// No Metadata Documentation available. /// @@ -1267,12 +1267,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("Size"); OnSizeChanged(); } - + } private global::System.String _Size; partial void OnSizeChanging(global::System.String value); partial void OnSizeChanged(); - + /// /// No Metadata Documentation available. /// @@ -1292,12 +1292,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("SizeUnitMeasureCode"); OnSizeUnitMeasureCodeChanged(); } - + } private global::System.String _SizeUnitMeasureCode; partial void OnSizeUnitMeasureCodeChanging(global::System.String value); partial void OnSizeUnitMeasureCodeChanged(); - + /// /// No Metadata Documentation available. /// @@ -1317,12 +1317,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("WeightUnitMeasureCode"); OnWeightUnitMeasureCodeChanged(); } - + } private global::System.String _WeightUnitMeasureCode; partial void OnWeightUnitMeasureCodeChanging(global::System.String value); partial void OnWeightUnitMeasureCodeChanged(); - + /// /// No Metadata Documentation available. /// @@ -1342,12 +1342,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("Weight"); OnWeightChanged(); } - + } private Nullable _Weight; partial void OnWeightChanging(Nullable value); partial void OnWeightChanged(); - + /// /// No Metadata Documentation available. /// @@ -1367,12 +1367,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("DaysToManufacture"); OnDaysToManufactureChanged(); } - + } private global::System.Int32 _DaysToManufacture; partial void OnDaysToManufactureChanging(global::System.Int32 value); partial void OnDaysToManufactureChanged(); - + /// /// No Metadata Documentation available. /// @@ -1392,12 +1392,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("ProductLine"); OnProductLineChanged(); } - + } private global::System.String _ProductLine; partial void OnProductLineChanging(global::System.String value); partial void OnProductLineChanged(); - + /// /// No Metadata Documentation available. /// @@ -1417,12 +1417,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("Class"); OnClassChanged(); } - + } private global::System.String _Class; partial void OnClassChanging(global::System.String value); partial void OnClassChanged(); - + /// /// No Metadata Documentation available. /// @@ -1442,12 +1442,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("Style"); OnStyleChanged(); } - + } private global::System.String _Style; partial void OnStyleChanging(global::System.String value); partial void OnStyleChanged(); - + /// /// No Metadata Documentation available. /// @@ -1467,12 +1467,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("ProductSubcategoryID"); OnProductSubcategoryIDChanged(); } - + } private Nullable _ProductSubcategoryID; partial void OnProductSubcategoryIDChanging(Nullable value); partial void OnProductSubcategoryIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1492,12 +1492,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("ProductModelID"); OnProductModelIDChanged(); } - + } private Nullable _ProductModelID; partial void OnProductModelIDChanging(Nullable value); partial void OnProductModelIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1517,12 +1517,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("SellStartDate"); OnSellStartDateChanged(); } - + } private global::System.DateTime _SellStartDate; partial void OnSellStartDateChanging(global::System.DateTime value); partial void OnSellStartDateChanged(); - + /// /// No Metadata Documentation available. /// @@ -1542,12 +1542,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("SellEndDate"); OnSellEndDateChanged(); } - + } private Nullable _SellEndDate; partial void OnSellEndDateChanging(Nullable value); partial void OnSellEndDateChanged(); - + /// /// No Metadata Documentation available. /// @@ -1567,12 +1567,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("DiscontinuedDate"); OnDiscontinuedDateChanged(); } - + } private Nullable _DiscontinuedDate; partial void OnDiscontinuedDateChanging(Nullable value); partial void OnDiscontinuedDateChanged(); - + /// /// No Metadata Documentation available. /// @@ -1592,12 +1592,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("rowguid"); OnrowguidChanged(); } - + } private global::System.Guid _rowguid; partial void OnrowguidChanging(global::System.Guid value); partial void OnrowguidChanged(); - + /// /// No Metadata Documentation available. /// @@ -1617,16 +1617,16 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("ModifiedDate"); OnModifiedDateChanged(); } - + } private global::System.DateTime _ModifiedDate; partial void OnModifiedDateChanging(global::System.DateTime value); partial void OnModifiedDateChanged(); - + #endregion - + } - + /// /// No Metadata Documentation available. /// @@ -1653,25 +1653,25 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales { SalesOrderDetail salesOrderDetail = new SalesOrderDetail(); salesOrderDetail.SalesOrderID = salesOrderID; - + salesOrderDetail.SalesOrderDetailID = salesOrderDetailID; - + salesOrderDetail.OrderQty = orderQty; - + salesOrderDetail.ProductID = productID; - + salesOrderDetail.SpecialOfferID = specialOfferID; - + salesOrderDetail.UnitPrice = unitPrice; - + salesOrderDetail.UnitPriceDiscount = unitPriceDiscount; - + salesOrderDetail.LineTotal = lineTotal; - + salesOrderDetail.rowguid = rowguid; - + salesOrderDetail.ModifiedDate = modifiedDate; - + return salesOrderDetail; } #endregion @@ -1699,12 +1699,12 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales OnSalesOrderIDChanged(); } } - + } private global::System.Int32 _SalesOrderID; partial void OnSalesOrderIDChanging(global::System.Int32 value); partial void OnSalesOrderIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1727,12 +1727,12 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales OnSalesOrderDetailIDChanged(); } } - + } private global::System.Int32 _SalesOrderDetailID; partial void OnSalesOrderDetailIDChanging(global::System.Int32 value); partial void OnSalesOrderDetailIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1752,12 +1752,12 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales ReportPropertyChanged("CarrierTrackingNumber"); OnCarrierTrackingNumberChanged(); } - + } private global::System.String _CarrierTrackingNumber; partial void OnCarrierTrackingNumberChanging(global::System.String value); partial void OnCarrierTrackingNumberChanged(); - + /// /// No Metadata Documentation available. /// @@ -1777,12 +1777,12 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales ReportPropertyChanged("OrderQty"); OnOrderQtyChanged(); } - + } private global::System.Int16 _OrderQty; partial void OnOrderQtyChanging(global::System.Int16 value); partial void OnOrderQtyChanged(); - + /// /// No Metadata Documentation available. /// @@ -1802,12 +1802,12 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales ReportPropertyChanged("ProductID"); OnProductIDChanged(); } - + } private global::System.Int32 _ProductID; partial void OnProductIDChanging(global::System.Int32 value); partial void OnProductIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1827,12 +1827,12 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales ReportPropertyChanged("SpecialOfferID"); OnSpecialOfferIDChanged(); } - + } private global::System.Int32 _SpecialOfferID; partial void OnSpecialOfferIDChanging(global::System.Int32 value); partial void OnSpecialOfferIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1852,12 +1852,12 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales ReportPropertyChanged("UnitPrice"); OnUnitPriceChanged(); } - + } private global::System.Decimal _UnitPrice; partial void OnUnitPriceChanging(global::System.Decimal value); partial void OnUnitPriceChanged(); - + /// /// No Metadata Documentation available. /// @@ -1877,12 +1877,12 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales ReportPropertyChanged("UnitPriceDiscount"); OnUnitPriceDiscountChanged(); } - + } private global::System.Decimal _UnitPriceDiscount; partial void OnUnitPriceDiscountChanging(global::System.Decimal value); partial void OnUnitPriceDiscountChanged(); - + /// /// No Metadata Documentation available. /// @@ -1902,12 +1902,12 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales ReportPropertyChanged("LineTotal"); OnLineTotalChanged(); } - + } private global::System.Decimal _LineTotal; partial void OnLineTotalChanging(global::System.Decimal value); partial void OnLineTotalChanged(); - + /// /// No Metadata Documentation available. /// @@ -1927,12 +1927,12 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales ReportPropertyChanged("rowguid"); OnrowguidChanged(); } - + } private global::System.Guid _rowguid; partial void OnrowguidChanging(global::System.Guid value); partial void OnrowguidChanged(); - + /// /// No Metadata Documentation available. /// @@ -1952,14 +1952,14 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales ReportPropertyChanged("ModifiedDate"); OnModifiedDateChanged(); } - + } private global::System.DateTime _ModifiedDate; partial void OnModifiedDateChanging(global::System.DateTime value); partial void OnModifiedDateChanged(); - + #endregion - + #region Navigation Properties /// /// No Metadata Documentation available. @@ -1967,7 +1967,7 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderDetail_SalesOrderHeader_SalesOrderID", "SalesOrderHeader")] + [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderDetail_SalesOrderHeader_SalesOrderID", "SalesOrderHeader")] public SalesOrderHeader SalesOrderHeader { get @@ -2000,7 +2000,7 @@ public EntityReference SalesOrderHeaderReference } #endregion } - + /// /// No Metadata Documentation available. /// @@ -2035,41 +2035,41 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales { SalesOrderHeader salesOrderHeader = new SalesOrderHeader(); salesOrderHeader.SalesOrderID = salesOrderID; - + salesOrderHeader.RevisionNumber = revisionNumber; - + salesOrderHeader.OrderDate = orderDate; - + salesOrderHeader.DueDate = dueDate; - + salesOrderHeader.Status = status; - + salesOrderHeader.OnlineOrderFlag = onlineOrderFlag; - + salesOrderHeader.SalesOrderNumber = salesOrderNumber; - + salesOrderHeader.CustomerID = customerID; - + salesOrderHeader.ContactID = contactID; - + salesOrderHeader.BillToAddressID = billToAddressID; - + salesOrderHeader.ShipToAddressID = shipToAddressID; - + salesOrderHeader.ShipMethodID = shipMethodID; - + salesOrderHeader.SubTotal = subTotal; - + salesOrderHeader.TaxAmt = taxAmt; - + salesOrderHeader.Freight = freight; - + salesOrderHeader.TotalDue = totalDue; - + salesOrderHeader.rowguid = rowguid; - + salesOrderHeader.ModifiedDate = modifiedDate; - + return salesOrderHeader; } #endregion @@ -2097,12 +2097,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales OnSalesOrderIDChanged(); } } - + } private global::System.Int32 _SalesOrderID; partial void OnSalesOrderIDChanging(global::System.Int32 value); partial void OnSalesOrderIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2122,12 +2122,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("RevisionNumber"); OnRevisionNumberChanged(); } - + } private global::System.Byte _RevisionNumber; partial void OnRevisionNumberChanging(global::System.Byte value); partial void OnRevisionNumberChanged(); - + /// /// No Metadata Documentation available. /// @@ -2147,12 +2147,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("OrderDate"); OnOrderDateChanged(); } - + } private global::System.DateTime _OrderDate; partial void OnOrderDateChanging(global::System.DateTime value); partial void OnOrderDateChanged(); - + /// /// No Metadata Documentation available. /// @@ -2172,12 +2172,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("DueDate"); OnDueDateChanged(); } - + } private global::System.DateTime _DueDate; partial void OnDueDateChanging(global::System.DateTime value); partial void OnDueDateChanged(); - + /// /// No Metadata Documentation available. /// @@ -2197,12 +2197,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("ShipDate"); OnShipDateChanged(); } - + } private Nullable _ShipDate; partial void OnShipDateChanging(Nullable value); partial void OnShipDateChanged(); - + /// /// No Metadata Documentation available. /// @@ -2222,12 +2222,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("Status"); OnStatusChanged(); } - + } private global::System.Byte _Status; partial void OnStatusChanging(global::System.Byte value); partial void OnStatusChanged(); - + /// /// No Metadata Documentation available. /// @@ -2247,12 +2247,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("OnlineOrderFlag"); OnOnlineOrderFlagChanged(); } - + } private global::System.Boolean _OnlineOrderFlag; partial void OnOnlineOrderFlagChanging(global::System.Boolean value); partial void OnOnlineOrderFlagChanged(); - + /// /// No Metadata Documentation available. /// @@ -2272,12 +2272,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("SalesOrderNumber"); OnSalesOrderNumberChanged(); } - + } private global::System.String _SalesOrderNumber; partial void OnSalesOrderNumberChanging(global::System.String value); partial void OnSalesOrderNumberChanged(); - + /// /// No Metadata Documentation available. /// @@ -2297,12 +2297,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("PurchaseOrderNumber"); OnPurchaseOrderNumberChanged(); } - + } private global::System.String _PurchaseOrderNumber; partial void OnPurchaseOrderNumberChanging(global::System.String value); partial void OnPurchaseOrderNumberChanged(); - + /// /// No Metadata Documentation available. /// @@ -2322,12 +2322,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("AccountNumber"); OnAccountNumberChanged(); } - + } private global::System.String _AccountNumber; partial void OnAccountNumberChanging(global::System.String value); partial void OnAccountNumberChanged(); - + /// /// No Metadata Documentation available. /// @@ -2347,12 +2347,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("CustomerID"); OnCustomerIDChanged(); } - + } private global::System.Int32 _CustomerID; partial void OnCustomerIDChanging(global::System.Int32 value); partial void OnCustomerIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2372,12 +2372,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("ContactID"); OnContactIDChanged(); } - + } private global::System.Int32 _ContactID; partial void OnContactIDChanging(global::System.Int32 value); partial void OnContactIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2397,12 +2397,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("SalesPersonID"); OnSalesPersonIDChanged(); } - + } private Nullable _SalesPersonID; partial void OnSalesPersonIDChanging(Nullable value); partial void OnSalesPersonIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2422,12 +2422,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("TerritoryID"); OnTerritoryIDChanged(); } - + } private Nullable _TerritoryID; partial void OnTerritoryIDChanging(Nullable value); partial void OnTerritoryIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2447,12 +2447,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("BillToAddressID"); OnBillToAddressIDChanged(); } - + } private global::System.Int32 _BillToAddressID; partial void OnBillToAddressIDChanging(global::System.Int32 value); partial void OnBillToAddressIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2472,12 +2472,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("ShipToAddressID"); OnShipToAddressIDChanged(); } - + } private global::System.Int32 _ShipToAddressID; partial void OnShipToAddressIDChanging(global::System.Int32 value); partial void OnShipToAddressIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2497,12 +2497,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("ShipMethodID"); OnShipMethodIDChanged(); } - + } private global::System.Int32 _ShipMethodID; partial void OnShipMethodIDChanging(global::System.Int32 value); partial void OnShipMethodIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2522,12 +2522,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("CreditCardID"); OnCreditCardIDChanged(); } - + } private Nullable _CreditCardID; partial void OnCreditCardIDChanging(Nullable value); partial void OnCreditCardIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2547,12 +2547,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("CreditCardApprovalCode"); OnCreditCardApprovalCodeChanged(); } - + } private global::System.String _CreditCardApprovalCode; partial void OnCreditCardApprovalCodeChanging(global::System.String value); partial void OnCreditCardApprovalCodeChanged(); - + /// /// No Metadata Documentation available. /// @@ -2572,12 +2572,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("CurrencyRateID"); OnCurrencyRateIDChanged(); } - + } private Nullable _CurrencyRateID; partial void OnCurrencyRateIDChanging(Nullable value); partial void OnCurrencyRateIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2597,12 +2597,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("SubTotal"); OnSubTotalChanged(); } - + } private global::System.Decimal _SubTotal; partial void OnSubTotalChanging(global::System.Decimal value); partial void OnSubTotalChanged(); - + /// /// No Metadata Documentation available. /// @@ -2622,12 +2622,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("TaxAmt"); OnTaxAmtChanged(); } - + } private global::System.Decimal _TaxAmt; partial void OnTaxAmtChanging(global::System.Decimal value); partial void OnTaxAmtChanged(); - + /// /// No Metadata Documentation available. /// @@ -2647,12 +2647,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("Freight"); OnFreightChanged(); } - + } private global::System.Decimal _Freight; partial void OnFreightChanging(global::System.Decimal value); partial void OnFreightChanged(); - + /// /// No Metadata Documentation available. /// @@ -2672,12 +2672,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("TotalDue"); OnTotalDueChanged(); } - + } private global::System.Decimal _TotalDue; partial void OnTotalDueChanging(global::System.Decimal value); partial void OnTotalDueChanged(); - + /// /// No Metadata Documentation available. /// @@ -2697,12 +2697,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("Comment"); OnCommentChanged(); } - + } private global::System.String _Comment; partial void OnCommentChanging(global::System.String value); partial void OnCommentChanged(); - + /// /// No Metadata Documentation available. /// @@ -2722,12 +2722,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("rowguid"); OnrowguidChanged(); } - + } private global::System.Guid _rowguid; partial void OnrowguidChanging(global::System.Guid value); partial void OnrowguidChanged(); - + /// /// No Metadata Documentation available. /// @@ -2747,14 +2747,14 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("ModifiedDate"); OnModifiedDateChanged(); } - + } private global::System.DateTime _ModifiedDate; partial void OnModifiedDateChanging(global::System.DateTime value); partial void OnModifiedDateChanged(); - + #endregion - + #region Navigation Properties /// /// No Metadata Documentation available. @@ -2762,7 +2762,7 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Address_BillToAddressID", "Address")] + [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Address_BillToAddressID", "Address")] public Address Address { get @@ -2799,7 +2799,7 @@ public EntityReference
AddressReference [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Address_ShipToAddressID", "Address")] + [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Address_ShipToAddressID", "Address")] public Address Address1 { get @@ -2836,7 +2836,7 @@ public EntityReference
Address1Reference [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Contact_ContactID", "Contact")] + [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Contact_ContactID", "Contact")] public Contact Contact { get @@ -2873,7 +2873,7 @@ public EntityReference ContactReference [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderDetail_SalesOrderHeader_SalesOrderID", "SalesOrderDetail")] + [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderDetail_SalesOrderHeader_SalesOrderID", "SalesOrderDetail")] public EntityCollection SalesOrderDetails { get @@ -2890,7 +2890,7 @@ public EntityCollection SalesOrderDetails } #endregion } - + #endregion - + } diff --git a/samples/snippets/csharp/VS_Snippets_Data/dp l2e arraysandlistsinqueries/cs/program.cs b/samples/snippets/csharp/VS_Snippets_Data/dp l2e arraysandlistsinqueries/cs/program.cs index ac1022e67e6b9..1195d5ebc8b51 100644 --- a/samples/snippets/csharp/VS_Snippets_Data/dp l2e arraysandlistsinqueries/cs/program.cs +++ b/samples/snippets/csharp/VS_Snippets_Data/dp l2e arraysandlistsinqueries/cs/program.cs @@ -43,8 +43,8 @@ static void B() select p; foreach (var product in products) { - Console.WriteLine("{0}: {1}, {2}", product.ProductID, - product.ProductModelID, + Console.WriteLine("{0}: {1}, {2}", product.ProductID, + product.ProductModelID, product.Size); } } @@ -59,7 +59,7 @@ static void C() int?[] productModelIds = { 19, 26, 118 }; var products = AWEntities.Products. Where(p => productModelIds.Contains(p.ProductModelID)); - + foreach (var product in products) { Console.WriteLine("{0}: {1}", product.ProductModelID, product.ProductID); @@ -74,13 +74,13 @@ static void D() using (AdventureWorksEntities AWEntities = new AdventureWorksEntities()) { var products = AWEntities.Products. - Where(p => (new int?[] { 19, 26, 18 }).Contains(p.ProductModelID) || + Where(p => (new int?[] { 19, 26, 18 }).Contains(p.ProductModelID) || (new string[] { "L", "XL" }).Contains(p.Size)); - + foreach (var product in products) { - Console.WriteLine("{0}: {1}, {2}", product.ProductID, - product.ProductModelID, + Console.WriteLine("{0}: {1}, {2}", product.ProductID, + product.ProductModelID, product.Size); } } diff --git a/samples/snippets/csharp/VS_Snippets_Data/dp l2e canonicalandstorefunctions/cs/adventureworks.designer.cs b/samples/snippets/csharp/VS_Snippets_Data/dp l2e canonicalandstorefunctions/cs/adventureworks.designer.cs index 5c35684408d29..d757bad4b83de 100644 --- a/samples/snippets/csharp/VS_Snippets_Data/dp l2e canonicalandstorefunctions/cs/adventureworks.designer.cs +++ b/samples/snippets/csharp/VS_Snippets_Data/dp l2e canonicalandstorefunctions/cs/adventureworks.designer.cs @@ -40,7 +40,7 @@ public AdventureWorksEntities() : base("name=AdventureWorksEntities", "Adventure { OnContextCreated(); } - + /// /// Initialize a new AdventureWorksEntities object. /// @@ -48,7 +48,7 @@ public AdventureWorksEntities(string connectionString) : base(connectionString, { OnContextCreated(); } - + /// /// Initialize a new AdventureWorksEntities object. /// @@ -57,11 +57,11 @@ public AdventureWorksEntities(EntityConnection connection) : base(connection, "A OnContextCreated(); } #endregion - + #region Partial Methods partial void OnContextCreated(); #endregion - + #region ObjectSet Properties /// /// No Metadata Documentation available. @@ -78,7 +78,7 @@ public ObjectSet
Addresses } } private ObjectSet
_Addresses; - + /// /// No Metadata Documentation available. /// @@ -94,7 +94,7 @@ public ObjectSet Contacts } } private ObjectSet _Contacts; - + /// /// No Metadata Documentation available. /// @@ -110,7 +110,7 @@ public ObjectSet Products } } private ObjectSet _Products; - + /// /// No Metadata Documentation available. /// @@ -126,7 +126,7 @@ public ObjectSet SalesOrderDetails } } private ObjectSet _SalesOrderDetails; - + /// /// No Metadata Documentation available. /// @@ -142,10 +142,10 @@ public ObjectSet SalesOrderHeaders } } private ObjectSet _SalesOrderHeaders; - + #endregion #region AddTo Methods - + /// /// Deprecated Method for adding a new object to the Addresses EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// @@ -153,7 +153,7 @@ public void AddToAddresses(Address address) { base.AddObject("Addresses", address); } - + /// /// Deprecated Method for adding a new object to the Contacts EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// @@ -161,7 +161,7 @@ public void AddToContacts(Contact contact) { base.AddObject("Contacts", contact); } - + /// /// Deprecated Method for adding a new object to the Products EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// @@ -169,7 +169,7 @@ public void AddToProducts(Product product) { base.AddObject("Products", product); } - + /// /// Deprecated Method for adding a new object to the SalesOrderDetails EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// @@ -177,7 +177,7 @@ public void AddToSalesOrderDetails(SalesOrderDetail salesOrderDetail) { base.AddObject("SalesOrderDetails", salesOrderDetail); } - + /// /// Deprecated Method for adding a new object to the SalesOrderHeaders EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// @@ -187,10 +187,10 @@ public void AddToSalesOrderHeaders(SalesOrderHeader salesOrderHeader) } #endregion } - + #endregion - - + + #region Entities /// /// No Metadata Documentation available. @@ -215,19 +215,19 @@ public static Address CreateAddress(global::System.Int32 addressID, global::Syst { Address address = new Address(); address.AddressID = addressID; - + address.AddressLine1 = addressLine1; - + address.City = city; - + address.StateProvinceID = stateProvinceID; - + address.PostalCode = postalCode; - + address.rowguid = rowguid; - + address.ModifiedDate = modifiedDate; - + return address; } #endregion @@ -255,12 +255,12 @@ public static Address CreateAddress(global::System.Int32 addressID, global::Syst OnAddressIDChanged(); } } - + } private global::System.Int32 _AddressID; partial void OnAddressIDChanging(global::System.Int32 value); partial void OnAddressIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -280,12 +280,12 @@ public static Address CreateAddress(global::System.Int32 addressID, global::Syst ReportPropertyChanged("AddressLine1"); OnAddressLine1Changed(); } - + } private global::System.String _AddressLine1; partial void OnAddressLine1Changing(global::System.String value); partial void OnAddressLine1Changed(); - + /// /// No Metadata Documentation available. /// @@ -305,12 +305,12 @@ public static Address CreateAddress(global::System.Int32 addressID, global::Syst ReportPropertyChanged("AddressLine2"); OnAddressLine2Changed(); } - + } private global::System.String _AddressLine2; partial void OnAddressLine2Changing(global::System.String value); partial void OnAddressLine2Changed(); - + /// /// No Metadata Documentation available. /// @@ -330,12 +330,12 @@ public static Address CreateAddress(global::System.Int32 addressID, global::Syst ReportPropertyChanged("City"); OnCityChanged(); } - + } private global::System.String _City; partial void OnCityChanging(global::System.String value); partial void OnCityChanged(); - + /// /// No Metadata Documentation available. /// @@ -355,12 +355,12 @@ public static Address CreateAddress(global::System.Int32 addressID, global::Syst ReportPropertyChanged("StateProvinceID"); OnStateProvinceIDChanged(); } - + } private global::System.Int32 _StateProvinceID; partial void OnStateProvinceIDChanging(global::System.Int32 value); partial void OnStateProvinceIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -380,12 +380,12 @@ public static Address CreateAddress(global::System.Int32 addressID, global::Syst ReportPropertyChanged("PostalCode"); OnPostalCodeChanged(); } - + } private global::System.String _PostalCode; partial void OnPostalCodeChanging(global::System.String value); partial void OnPostalCodeChanged(); - + /// /// No Metadata Documentation available. /// @@ -405,12 +405,12 @@ public static Address CreateAddress(global::System.Int32 addressID, global::Syst ReportPropertyChanged("rowguid"); OnrowguidChanged(); } - + } private global::System.Guid _rowguid; partial void OnrowguidChanging(global::System.Guid value); partial void OnrowguidChanged(); - + /// /// No Metadata Documentation available. /// @@ -430,14 +430,14 @@ public static Address CreateAddress(global::System.Int32 addressID, global::Syst ReportPropertyChanged("ModifiedDate"); OnModifiedDateChanged(); } - + } private global::System.DateTime _ModifiedDate; partial void OnModifiedDateChanging(global::System.DateTime value); partial void OnModifiedDateChanged(); - + #endregion - + #region Navigation Properties /// /// No Metadata Documentation available. @@ -445,7 +445,7 @@ public static Address CreateAddress(global::System.Int32 addressID, global::Syst [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Address_BillToAddressID", "SalesOrderHeader")] + [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Address_BillToAddressID", "SalesOrderHeader")] public EntityCollection SalesOrderHeaders { get @@ -466,7 +466,7 @@ public EntityCollection SalesOrderHeaders [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Address_ShipToAddressID", "SalesOrderHeader")] + [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Address_ShipToAddressID", "SalesOrderHeader")] public EntityCollection SalesOrderHeaders1 { get @@ -483,7 +483,7 @@ public EntityCollection SalesOrderHeaders1 } #endregion } - + /// /// No Metadata Documentation available. /// @@ -509,23 +509,23 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst { Contact contact = new Contact(); contact.ContactID = contactID; - + contact.NameStyle = nameStyle; - + contact.FirstName = firstName; - + contact.LastName = lastName; - + contact.EmailPromotion = emailPromotion; - + contact.PasswordHash = passwordHash; - + contact.PasswordSalt = passwordSalt; - + contact.rowguid = rowguid; - + contact.ModifiedDate = modifiedDate; - + return contact; } #endregion @@ -553,12 +553,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst OnContactIDChanged(); } } - + } private global::System.Int32 _ContactID; partial void OnContactIDChanging(global::System.Int32 value); partial void OnContactIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -578,12 +578,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("NameStyle"); OnNameStyleChanged(); } - + } private global::System.Boolean _NameStyle; partial void OnNameStyleChanging(global::System.Boolean value); partial void OnNameStyleChanged(); - + /// /// No Metadata Documentation available. /// @@ -603,12 +603,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("Title"); OnTitleChanged(); } - + } private global::System.String _Title; partial void OnTitleChanging(global::System.String value); partial void OnTitleChanged(); - + /// /// No Metadata Documentation available. /// @@ -628,12 +628,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("FirstName"); OnFirstNameChanged(); } - + } private global::System.String _FirstName; partial void OnFirstNameChanging(global::System.String value); partial void OnFirstNameChanged(); - + /// /// No Metadata Documentation available. /// @@ -653,12 +653,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("MiddleName"); OnMiddleNameChanged(); } - + } private global::System.String _MiddleName; partial void OnMiddleNameChanging(global::System.String value); partial void OnMiddleNameChanged(); - + /// /// No Metadata Documentation available. /// @@ -678,12 +678,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("LastName"); OnLastNameChanged(); } - + } private global::System.String _LastName; partial void OnLastNameChanging(global::System.String value); partial void OnLastNameChanged(); - + /// /// No Metadata Documentation available. /// @@ -703,12 +703,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("Suffix"); OnSuffixChanged(); } - + } private global::System.String _Suffix; partial void OnSuffixChanging(global::System.String value); partial void OnSuffixChanged(); - + /// /// No Metadata Documentation available. /// @@ -728,12 +728,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("EmailAddress"); OnEmailAddressChanged(); } - + } private global::System.String _EmailAddress; partial void OnEmailAddressChanging(global::System.String value); partial void OnEmailAddressChanged(); - + /// /// No Metadata Documentation available. /// @@ -753,12 +753,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("EmailPromotion"); OnEmailPromotionChanged(); } - + } private global::System.Int32 _EmailPromotion; partial void OnEmailPromotionChanging(global::System.Int32 value); partial void OnEmailPromotionChanged(); - + /// /// No Metadata Documentation available. /// @@ -778,12 +778,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("Phone"); OnPhoneChanged(); } - + } private global::System.String _Phone; partial void OnPhoneChanging(global::System.String value); partial void OnPhoneChanged(); - + /// /// No Metadata Documentation available. /// @@ -803,12 +803,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("PasswordHash"); OnPasswordHashChanged(); } - + } private global::System.String _PasswordHash; partial void OnPasswordHashChanging(global::System.String value); partial void OnPasswordHashChanged(); - + /// /// No Metadata Documentation available. /// @@ -828,12 +828,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("PasswordSalt"); OnPasswordSaltChanged(); } - + } private global::System.String _PasswordSalt; partial void OnPasswordSaltChanging(global::System.String value); partial void OnPasswordSaltChanged(); - + /// /// No Metadata Documentation available. /// @@ -853,12 +853,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("AdditionalContactInfo"); OnAdditionalContactInfoChanged(); } - + } private global::System.String _AdditionalContactInfo; partial void OnAdditionalContactInfoChanging(global::System.String value); partial void OnAdditionalContactInfoChanged(); - + /// /// No Metadata Documentation available. /// @@ -878,12 +878,12 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("rowguid"); OnrowguidChanged(); } - + } private global::System.Guid _rowguid; partial void OnrowguidChanging(global::System.Guid value); partial void OnrowguidChanged(); - + /// /// No Metadata Documentation available. /// @@ -903,14 +903,14 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst ReportPropertyChanged("ModifiedDate"); OnModifiedDateChanged(); } - + } private global::System.DateTime _ModifiedDate; partial void OnModifiedDateChanging(global::System.DateTime value); partial void OnModifiedDateChanged(); - + #endregion - + #region Navigation Properties /// /// No Metadata Documentation available. @@ -918,7 +918,7 @@ public static Contact CreateContact(global::System.Int32 contactID, global::Syst [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Contact_ContactID", "SalesOrderHeader")] + [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Contact_ContactID", "SalesOrderHeader")] public EntityCollection SalesOrderHeaders { get @@ -935,7 +935,7 @@ public EntityCollection SalesOrderHeaders } #endregion } - + /// /// No Metadata Documentation available. /// @@ -965,31 +965,31 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst { Product product = new Product(); product.ProductID = productID; - + product.Name = name; - + product.ProductNumber = productNumber; - + product.MakeFlag = makeFlag; - + product.FinishedGoodsFlag = finishedGoodsFlag; - + product.SafetyStockLevel = safetyStockLevel; - + product.ReorderPoint = reorderPoint; - + product.StandardCost = standardCost; - + product.ListPrice = listPrice; - + product.DaysToManufacture = daysToManufacture; - + product.SellStartDate = sellStartDate; - + product.rowguid = rowguid; - + product.ModifiedDate = modifiedDate; - + return product; } #endregion @@ -1017,12 +1017,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst OnProductIDChanged(); } } - + } private global::System.Int32 _ProductID; partial void OnProductIDChanging(global::System.Int32 value); partial void OnProductIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1042,12 +1042,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("Name"); OnNameChanged(); } - + } private global::System.String _Name; partial void OnNameChanging(global::System.String value); partial void OnNameChanged(); - + /// /// No Metadata Documentation available. /// @@ -1067,12 +1067,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("ProductNumber"); OnProductNumberChanged(); } - + } private global::System.String _ProductNumber; partial void OnProductNumberChanging(global::System.String value); partial void OnProductNumberChanged(); - + /// /// No Metadata Documentation available. /// @@ -1092,12 +1092,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("MakeFlag"); OnMakeFlagChanged(); } - + } private global::System.Boolean _MakeFlag; partial void OnMakeFlagChanging(global::System.Boolean value); partial void OnMakeFlagChanged(); - + /// /// No Metadata Documentation available. /// @@ -1117,12 +1117,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("FinishedGoodsFlag"); OnFinishedGoodsFlagChanged(); } - + } private global::System.Boolean _FinishedGoodsFlag; partial void OnFinishedGoodsFlagChanging(global::System.Boolean value); partial void OnFinishedGoodsFlagChanged(); - + /// /// No Metadata Documentation available. /// @@ -1142,12 +1142,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("Color"); OnColorChanged(); } - + } private global::System.String _Color; partial void OnColorChanging(global::System.String value); partial void OnColorChanged(); - + /// /// No Metadata Documentation available. /// @@ -1167,12 +1167,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("SafetyStockLevel"); OnSafetyStockLevelChanged(); } - + } private global::System.Int16 _SafetyStockLevel; partial void OnSafetyStockLevelChanging(global::System.Int16 value); partial void OnSafetyStockLevelChanged(); - + /// /// No Metadata Documentation available. /// @@ -1192,12 +1192,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("ReorderPoint"); OnReorderPointChanged(); } - + } private global::System.Int16 _ReorderPoint; partial void OnReorderPointChanging(global::System.Int16 value); partial void OnReorderPointChanged(); - + /// /// No Metadata Documentation available. /// @@ -1217,12 +1217,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("StandardCost"); OnStandardCostChanged(); } - + } private global::System.Decimal _StandardCost; partial void OnStandardCostChanging(global::System.Decimal value); partial void OnStandardCostChanged(); - + /// /// No Metadata Documentation available. /// @@ -1242,12 +1242,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("ListPrice"); OnListPriceChanged(); } - + } private global::System.Decimal _ListPrice; partial void OnListPriceChanging(global::System.Decimal value); partial void OnListPriceChanged(); - + /// /// No Metadata Documentation available. /// @@ -1267,12 +1267,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("Size"); OnSizeChanged(); } - + } private global::System.String _Size; partial void OnSizeChanging(global::System.String value); partial void OnSizeChanged(); - + /// /// No Metadata Documentation available. /// @@ -1292,12 +1292,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("SizeUnitMeasureCode"); OnSizeUnitMeasureCodeChanged(); } - + } private global::System.String _SizeUnitMeasureCode; partial void OnSizeUnitMeasureCodeChanging(global::System.String value); partial void OnSizeUnitMeasureCodeChanged(); - + /// /// No Metadata Documentation available. /// @@ -1317,12 +1317,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("WeightUnitMeasureCode"); OnWeightUnitMeasureCodeChanged(); } - + } private global::System.String _WeightUnitMeasureCode; partial void OnWeightUnitMeasureCodeChanging(global::System.String value); partial void OnWeightUnitMeasureCodeChanged(); - + /// /// No Metadata Documentation available. /// @@ -1342,12 +1342,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("Weight"); OnWeightChanged(); } - + } private Nullable _Weight; partial void OnWeightChanging(Nullable value); partial void OnWeightChanged(); - + /// /// No Metadata Documentation available. /// @@ -1367,12 +1367,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("DaysToManufacture"); OnDaysToManufactureChanged(); } - + } private global::System.Int32 _DaysToManufacture; partial void OnDaysToManufactureChanging(global::System.Int32 value); partial void OnDaysToManufactureChanged(); - + /// /// No Metadata Documentation available. /// @@ -1392,12 +1392,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("ProductLine"); OnProductLineChanged(); } - + } private global::System.String _ProductLine; partial void OnProductLineChanging(global::System.String value); partial void OnProductLineChanged(); - + /// /// No Metadata Documentation available. /// @@ -1417,12 +1417,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("Class"); OnClassChanged(); } - + } private global::System.String _Class; partial void OnClassChanging(global::System.String value); partial void OnClassChanged(); - + /// /// No Metadata Documentation available. /// @@ -1442,12 +1442,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("Style"); OnStyleChanged(); } - + } private global::System.String _Style; partial void OnStyleChanging(global::System.String value); partial void OnStyleChanged(); - + /// /// No Metadata Documentation available. /// @@ -1467,12 +1467,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("ProductSubcategoryID"); OnProductSubcategoryIDChanged(); } - + } private Nullable _ProductSubcategoryID; partial void OnProductSubcategoryIDChanging(Nullable value); partial void OnProductSubcategoryIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1492,12 +1492,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("ProductModelID"); OnProductModelIDChanged(); } - + } private Nullable _ProductModelID; partial void OnProductModelIDChanging(Nullable value); partial void OnProductModelIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1517,12 +1517,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("SellStartDate"); OnSellStartDateChanged(); } - + } private global::System.DateTime _SellStartDate; partial void OnSellStartDateChanging(global::System.DateTime value); partial void OnSellStartDateChanged(); - + /// /// No Metadata Documentation available. /// @@ -1542,12 +1542,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("SellEndDate"); OnSellEndDateChanged(); } - + } private Nullable _SellEndDate; partial void OnSellEndDateChanging(Nullable value); partial void OnSellEndDateChanged(); - + /// /// No Metadata Documentation available. /// @@ -1567,12 +1567,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("DiscontinuedDate"); OnDiscontinuedDateChanged(); } - + } private Nullable _DiscontinuedDate; partial void OnDiscontinuedDateChanging(Nullable value); partial void OnDiscontinuedDateChanged(); - + /// /// No Metadata Documentation available. /// @@ -1592,12 +1592,12 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("rowguid"); OnrowguidChanged(); } - + } private global::System.Guid _rowguid; partial void OnrowguidChanging(global::System.Guid value); partial void OnrowguidChanged(); - + /// /// No Metadata Documentation available. /// @@ -1617,16 +1617,16 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst ReportPropertyChanged("ModifiedDate"); OnModifiedDateChanged(); } - + } private global::System.DateTime _ModifiedDate; partial void OnModifiedDateChanging(global::System.DateTime value); partial void OnModifiedDateChanged(); - + #endregion - + } - + /// /// No Metadata Documentation available. /// @@ -1653,25 +1653,25 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales { SalesOrderDetail salesOrderDetail = new SalesOrderDetail(); salesOrderDetail.SalesOrderID = salesOrderID; - + salesOrderDetail.SalesOrderDetailID = salesOrderDetailID; - + salesOrderDetail.OrderQty = orderQty; - + salesOrderDetail.ProductID = productID; - + salesOrderDetail.SpecialOfferID = specialOfferID; - + salesOrderDetail.UnitPrice = unitPrice; - + salesOrderDetail.UnitPriceDiscount = unitPriceDiscount; - + salesOrderDetail.LineTotal = lineTotal; - + salesOrderDetail.rowguid = rowguid; - + salesOrderDetail.ModifiedDate = modifiedDate; - + return salesOrderDetail; } #endregion @@ -1699,12 +1699,12 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales OnSalesOrderIDChanged(); } } - + } private global::System.Int32 _SalesOrderID; partial void OnSalesOrderIDChanging(global::System.Int32 value); partial void OnSalesOrderIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1727,12 +1727,12 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales OnSalesOrderDetailIDChanged(); } } - + } private global::System.Int32 _SalesOrderDetailID; partial void OnSalesOrderDetailIDChanging(global::System.Int32 value); partial void OnSalesOrderDetailIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1752,12 +1752,12 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales ReportPropertyChanged("CarrierTrackingNumber"); OnCarrierTrackingNumberChanged(); } - + } private global::System.String _CarrierTrackingNumber; partial void OnCarrierTrackingNumberChanging(global::System.String value); partial void OnCarrierTrackingNumberChanged(); - + /// /// No Metadata Documentation available. /// @@ -1777,12 +1777,12 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales ReportPropertyChanged("OrderQty"); OnOrderQtyChanged(); } - + } private global::System.Int16 _OrderQty; partial void OnOrderQtyChanging(global::System.Int16 value); partial void OnOrderQtyChanged(); - + /// /// No Metadata Documentation available. /// @@ -1802,12 +1802,12 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales ReportPropertyChanged("ProductID"); OnProductIDChanged(); } - + } private global::System.Int32 _ProductID; partial void OnProductIDChanging(global::System.Int32 value); partial void OnProductIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1827,12 +1827,12 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales ReportPropertyChanged("SpecialOfferID"); OnSpecialOfferIDChanged(); } - + } private global::System.Int32 _SpecialOfferID; partial void OnSpecialOfferIDChanging(global::System.Int32 value); partial void OnSpecialOfferIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1852,12 +1852,12 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales ReportPropertyChanged("UnitPrice"); OnUnitPriceChanged(); } - + } private global::System.Decimal _UnitPrice; partial void OnUnitPriceChanging(global::System.Decimal value); partial void OnUnitPriceChanged(); - + /// /// No Metadata Documentation available. /// @@ -1877,12 +1877,12 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales ReportPropertyChanged("UnitPriceDiscount"); OnUnitPriceDiscountChanged(); } - + } private global::System.Decimal _UnitPriceDiscount; partial void OnUnitPriceDiscountChanging(global::System.Decimal value); partial void OnUnitPriceDiscountChanged(); - + /// /// No Metadata Documentation available. /// @@ -1902,12 +1902,12 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales ReportPropertyChanged("LineTotal"); OnLineTotalChanged(); } - + } private global::System.Decimal _LineTotal; partial void OnLineTotalChanging(global::System.Decimal value); partial void OnLineTotalChanged(); - + /// /// No Metadata Documentation available. /// @@ -1927,12 +1927,12 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales ReportPropertyChanged("rowguid"); OnrowguidChanged(); } - + } private global::System.Guid _rowguid; partial void OnrowguidChanging(global::System.Guid value); partial void OnrowguidChanged(); - + /// /// No Metadata Documentation available. /// @@ -1952,14 +1952,14 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales ReportPropertyChanged("ModifiedDate"); OnModifiedDateChanged(); } - + } private global::System.DateTime _ModifiedDate; partial void OnModifiedDateChanging(global::System.DateTime value); partial void OnModifiedDateChanged(); - + #endregion - + #region Navigation Properties /// /// No Metadata Documentation available. @@ -1967,7 +1967,7 @@ public static SalesOrderDetail CreateSalesOrderDetail(global::System.Int32 sales [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderDetail_SalesOrderHeader_SalesOrderID", "SalesOrderHeader")] + [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderDetail_SalesOrderHeader_SalesOrderID", "SalesOrderHeader")] public SalesOrderHeader SalesOrderHeader { get @@ -2000,7 +2000,7 @@ public EntityReference SalesOrderHeaderReference } #endregion } - + /// /// No Metadata Documentation available. /// @@ -2035,41 +2035,41 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales { SalesOrderHeader salesOrderHeader = new SalesOrderHeader(); salesOrderHeader.SalesOrderID = salesOrderID; - + salesOrderHeader.RevisionNumber = revisionNumber; - + salesOrderHeader.OrderDate = orderDate; - + salesOrderHeader.DueDate = dueDate; - + salesOrderHeader.Status = status; - + salesOrderHeader.OnlineOrderFlag = onlineOrderFlag; - + salesOrderHeader.SalesOrderNumber = salesOrderNumber; - + salesOrderHeader.CustomerID = customerID; - + salesOrderHeader.ContactID = contactID; - + salesOrderHeader.BillToAddressID = billToAddressID; - + salesOrderHeader.ShipToAddressID = shipToAddressID; - + salesOrderHeader.ShipMethodID = shipMethodID; - + salesOrderHeader.SubTotal = subTotal; - + salesOrderHeader.TaxAmt = taxAmt; - + salesOrderHeader.Freight = freight; - + salesOrderHeader.TotalDue = totalDue; - + salesOrderHeader.rowguid = rowguid; - + salesOrderHeader.ModifiedDate = modifiedDate; - + return salesOrderHeader; } #endregion @@ -2097,12 +2097,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales OnSalesOrderIDChanged(); } } - + } private global::System.Int32 _SalesOrderID; partial void OnSalesOrderIDChanging(global::System.Int32 value); partial void OnSalesOrderIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2122,12 +2122,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("RevisionNumber"); OnRevisionNumberChanged(); } - + } private global::System.Byte _RevisionNumber; partial void OnRevisionNumberChanging(global::System.Byte value); partial void OnRevisionNumberChanged(); - + /// /// No Metadata Documentation available. /// @@ -2147,12 +2147,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("OrderDate"); OnOrderDateChanged(); } - + } private global::System.DateTime _OrderDate; partial void OnOrderDateChanging(global::System.DateTime value); partial void OnOrderDateChanged(); - + /// /// No Metadata Documentation available. /// @@ -2172,12 +2172,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("DueDate"); OnDueDateChanged(); } - + } private global::System.DateTime _DueDate; partial void OnDueDateChanging(global::System.DateTime value); partial void OnDueDateChanged(); - + /// /// No Metadata Documentation available. /// @@ -2197,12 +2197,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("ShipDate"); OnShipDateChanged(); } - + } private Nullable _ShipDate; partial void OnShipDateChanging(Nullable value); partial void OnShipDateChanged(); - + /// /// No Metadata Documentation available. /// @@ -2222,12 +2222,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("Status"); OnStatusChanged(); } - + } private global::System.Byte _Status; partial void OnStatusChanging(global::System.Byte value); partial void OnStatusChanged(); - + /// /// No Metadata Documentation available. /// @@ -2247,12 +2247,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("OnlineOrderFlag"); OnOnlineOrderFlagChanged(); } - + } private global::System.Boolean _OnlineOrderFlag; partial void OnOnlineOrderFlagChanging(global::System.Boolean value); partial void OnOnlineOrderFlagChanged(); - + /// /// No Metadata Documentation available. /// @@ -2272,12 +2272,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("SalesOrderNumber"); OnSalesOrderNumberChanged(); } - + } private global::System.String _SalesOrderNumber; partial void OnSalesOrderNumberChanging(global::System.String value); partial void OnSalesOrderNumberChanged(); - + /// /// No Metadata Documentation available. /// @@ -2297,12 +2297,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("PurchaseOrderNumber"); OnPurchaseOrderNumberChanged(); } - + } private global::System.String _PurchaseOrderNumber; partial void OnPurchaseOrderNumberChanging(global::System.String value); partial void OnPurchaseOrderNumberChanged(); - + /// /// No Metadata Documentation available. /// @@ -2322,12 +2322,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("AccountNumber"); OnAccountNumberChanged(); } - + } private global::System.String _AccountNumber; partial void OnAccountNumberChanging(global::System.String value); partial void OnAccountNumberChanged(); - + /// /// No Metadata Documentation available. /// @@ -2347,12 +2347,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("CustomerID"); OnCustomerIDChanged(); } - + } private global::System.Int32 _CustomerID; partial void OnCustomerIDChanging(global::System.Int32 value); partial void OnCustomerIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2372,12 +2372,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("ContactID"); OnContactIDChanged(); } - + } private global::System.Int32 _ContactID; partial void OnContactIDChanging(global::System.Int32 value); partial void OnContactIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2397,12 +2397,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("SalesPersonID"); OnSalesPersonIDChanged(); } - + } private Nullable _SalesPersonID; partial void OnSalesPersonIDChanging(Nullable value); partial void OnSalesPersonIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2422,12 +2422,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("TerritoryID"); OnTerritoryIDChanged(); } - + } private Nullable _TerritoryID; partial void OnTerritoryIDChanging(Nullable value); partial void OnTerritoryIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2447,12 +2447,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("BillToAddressID"); OnBillToAddressIDChanged(); } - + } private global::System.Int32 _BillToAddressID; partial void OnBillToAddressIDChanging(global::System.Int32 value); partial void OnBillToAddressIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2472,12 +2472,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("ShipToAddressID"); OnShipToAddressIDChanged(); } - + } private global::System.Int32 _ShipToAddressID; partial void OnShipToAddressIDChanging(global::System.Int32 value); partial void OnShipToAddressIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2497,12 +2497,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("ShipMethodID"); OnShipMethodIDChanged(); } - + } private global::System.Int32 _ShipMethodID; partial void OnShipMethodIDChanging(global::System.Int32 value); partial void OnShipMethodIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2522,12 +2522,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("CreditCardID"); OnCreditCardIDChanged(); } - + } private Nullable _CreditCardID; partial void OnCreditCardIDChanging(Nullable value); partial void OnCreditCardIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2547,12 +2547,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("CreditCardApprovalCode"); OnCreditCardApprovalCodeChanged(); } - + } private global::System.String _CreditCardApprovalCode; partial void OnCreditCardApprovalCodeChanging(global::System.String value); partial void OnCreditCardApprovalCodeChanged(); - + /// /// No Metadata Documentation available. /// @@ -2572,12 +2572,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("CurrencyRateID"); OnCurrencyRateIDChanged(); } - + } private Nullable _CurrencyRateID; partial void OnCurrencyRateIDChanging(Nullable value); partial void OnCurrencyRateIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2597,12 +2597,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("SubTotal"); OnSubTotalChanged(); } - + } private global::System.Decimal _SubTotal; partial void OnSubTotalChanging(global::System.Decimal value); partial void OnSubTotalChanged(); - + /// /// No Metadata Documentation available. /// @@ -2622,12 +2622,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("TaxAmt"); OnTaxAmtChanged(); } - + } private global::System.Decimal _TaxAmt; partial void OnTaxAmtChanging(global::System.Decimal value); partial void OnTaxAmtChanged(); - + /// /// No Metadata Documentation available. /// @@ -2647,12 +2647,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("Freight"); OnFreightChanged(); } - + } private global::System.Decimal _Freight; partial void OnFreightChanging(global::System.Decimal value); partial void OnFreightChanged(); - + /// /// No Metadata Documentation available. /// @@ -2672,12 +2672,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("TotalDue"); OnTotalDueChanged(); } - + } private global::System.Decimal _TotalDue; partial void OnTotalDueChanging(global::System.Decimal value); partial void OnTotalDueChanged(); - + /// /// No Metadata Documentation available. /// @@ -2697,12 +2697,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("Comment"); OnCommentChanged(); } - + } private global::System.String _Comment; partial void OnCommentChanging(global::System.String value); partial void OnCommentChanged(); - + /// /// No Metadata Documentation available. /// @@ -2722,12 +2722,12 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("rowguid"); OnrowguidChanged(); } - + } private global::System.Guid _rowguid; partial void OnrowguidChanging(global::System.Guid value); partial void OnrowguidChanged(); - + /// /// No Metadata Documentation available. /// @@ -2747,14 +2747,14 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales ReportPropertyChanged("ModifiedDate"); OnModifiedDateChanged(); } - + } private global::System.DateTime _ModifiedDate; partial void OnModifiedDateChanging(global::System.DateTime value); partial void OnModifiedDateChanged(); - + #endregion - + #region Navigation Properties /// /// No Metadata Documentation available. @@ -2762,7 +2762,7 @@ public static SalesOrderHeader CreateSalesOrderHeader(global::System.Int32 sales [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Address_BillToAddressID", "Address")] + [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Address_BillToAddressID", "Address")] public Address Address { get @@ -2799,7 +2799,7 @@ public EntityReference
AddressReference [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Address_ShipToAddressID", "Address")] + [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Address_ShipToAddressID", "Address")] public Address Address1 { get @@ -2836,7 +2836,7 @@ public EntityReference
Address1Reference [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Contact_ContactID", "Contact")] + [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderHeader_Contact_ContactID", "Contact")] public Contact Contact { get @@ -2873,7 +2873,7 @@ public EntityReference ContactReference [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderDetail_SalesOrderHeader_SalesOrderID", "SalesOrderDetail")] + [EdmRelationshipNavigationPropertyAttribute("AdventureWorksModel", "FK_SalesOrderDetail_SalesOrderHeader_SalesOrderID", "SalesOrderDetail")] public EntityCollection SalesOrderDetails { get @@ -2890,7 +2890,7 @@ public EntityCollection SalesOrderDetails } #endregion } - + #endregion - + } diff --git a/samples/snippets/csharp/VS_Snippets_Data/dp l2e maptodbfunction/cs/school.designer.cs b/samples/snippets/csharp/VS_Snippets_Data/dp l2e maptodbfunction/cs/school.designer.cs index 445bfa38ef14f..cb97d9bb70e5e 100644 --- a/samples/snippets/csharp/VS_Snippets_Data/dp l2e maptodbfunction/cs/school.designer.cs +++ b/samples/snippets/csharp/VS_Snippets_Data/dp l2e maptodbfunction/cs/school.designer.cs @@ -43,7 +43,7 @@ public SchoolEntities() : base("name=SchoolEntities", "SchoolEntities") { OnContextCreated(); } - + /// /// Initialize a new SchoolEntities object. /// @@ -51,7 +51,7 @@ public SchoolEntities(string connectionString) : base(connectionString, "SchoolE { OnContextCreated(); } - + /// /// Initialize a new SchoolEntities object. /// @@ -60,11 +60,11 @@ public SchoolEntities(EntityConnection connection) : base(connection, "SchoolEnt OnContextCreated(); } #endregion - + #region Partial Methods partial void OnContextCreated(); #endregion - + #region ObjectSet Properties /// /// No Metadata Documentation available. @@ -81,7 +81,7 @@ public ObjectSet Courses } } private ObjectSet _Courses; - + /// /// No Metadata Documentation available. /// @@ -97,7 +97,7 @@ public ObjectSet Departments } } private ObjectSet _Departments; - + /// /// No Metadata Documentation available. /// @@ -113,7 +113,7 @@ public ObjectSet OfficeAssignments } } private ObjectSet _OfficeAssignments; - + /// /// No Metadata Documentation available. /// @@ -129,7 +129,7 @@ public ObjectSet OnlineCourses } } private ObjectSet _OnlineCourses; - + /// /// No Metadata Documentation available. /// @@ -145,7 +145,7 @@ public ObjectSet OnsiteCourses } } private ObjectSet _OnsiteCourses; - + /// /// No Metadata Documentation available. /// @@ -161,7 +161,7 @@ public ObjectSet People } } private ObjectSet _People; - + /// /// No Metadata Documentation available. /// @@ -177,10 +177,10 @@ public ObjectSet StudentGrades } } private ObjectSet _StudentGrades; - + #endregion #region AddTo Methods - + /// /// Deprecated Method for adding a new object to the Courses EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// @@ -188,7 +188,7 @@ public void AddToCourses(Course course) { base.AddObject("Courses", course); } - + /// /// Deprecated Method for adding a new object to the Departments EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// @@ -196,7 +196,7 @@ public void AddToDepartments(Department department) { base.AddObject("Departments", department); } - + /// /// Deprecated Method for adding a new object to the OfficeAssignments EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// @@ -204,7 +204,7 @@ public void AddToOfficeAssignments(OfficeAssignment officeAssignment) { base.AddObject("OfficeAssignments", officeAssignment); } - + /// /// Deprecated Method for adding a new object to the OnlineCourses EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// @@ -212,7 +212,7 @@ public void AddToOnlineCourses(OnlineCourse onlineCourse) { base.AddObject("OnlineCourses", onlineCourse); } - + /// /// Deprecated Method for adding a new object to the OnsiteCourses EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// @@ -220,7 +220,7 @@ public void AddToOnsiteCourses(OnsiteCourse onsiteCourse) { base.AddObject("OnsiteCourses", onsiteCourse); } - + /// /// Deprecated Method for adding a new object to the People EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// @@ -228,7 +228,7 @@ public void AddToPeople(Person person) { base.AddObject("People", person); } - + /// /// Deprecated Method for adding a new object to the StudentGrades EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// @@ -238,10 +238,10 @@ public void AddToStudentGrades(StudentGrade studentGrade) } #endregion } - + #endregion - - + + #region Entities /// /// No Metadata Documentation available. @@ -263,13 +263,13 @@ public static Course CreateCourse(global::System.Int32 courseID, global::System. { Course course = new Course(); course.CourseID = courseID; - + course.Title = title; - + course.Credits = credits; - + course.DepartmentID = departmentID; - + return course; } #endregion @@ -297,12 +297,12 @@ public static Course CreateCourse(global::System.Int32 courseID, global::System. OnCourseIDChanged(); } } - + } private global::System.Int32 _CourseID; partial void OnCourseIDChanging(global::System.Int32 value); partial void OnCourseIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -322,12 +322,12 @@ public static Course CreateCourse(global::System.Int32 courseID, global::System. ReportPropertyChanged("Title"); OnTitleChanged(); } - + } private global::System.String _Title; partial void OnTitleChanging(global::System.String value); partial void OnTitleChanged(); - + /// /// No Metadata Documentation available. /// @@ -347,12 +347,12 @@ public static Course CreateCourse(global::System.Int32 courseID, global::System. ReportPropertyChanged("Credits"); OnCreditsChanged(); } - + } private global::System.Int32 _Credits; partial void OnCreditsChanging(global::System.Int32 value); partial void OnCreditsChanged(); - + /// /// No Metadata Documentation available. /// @@ -372,14 +372,14 @@ public static Course CreateCourse(global::System.Int32 courseID, global::System. ReportPropertyChanged("DepartmentID"); OnDepartmentIDChanged(); } - + } private global::System.Int32 _DepartmentID; partial void OnDepartmentIDChanging(global::System.Int32 value); partial void OnDepartmentIDChanged(); - + #endregion - + #region Navigation Properties /// /// No Metadata Documentation available. @@ -387,7 +387,7 @@ public static Course CreateCourse(global::System.Int32 courseID, global::System. [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "FK_Course_Department", "Department")] + [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "FK_Course_Department", "Department")] public Department Department { get @@ -424,7 +424,7 @@ public EntityReference DepartmentReference [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "FK_OnlineCourse_Course", "OnlineCourse")] + [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "FK_OnlineCourse_Course", "OnlineCourse")] public OnlineCourse OnlineCourse { get @@ -461,7 +461,7 @@ public EntityReference OnlineCourseReference [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "FK_OnsiteCourse_Course", "OnsiteCourse")] + [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "FK_OnsiteCourse_Course", "OnsiteCourse")] public OnsiteCourse OnsiteCourse { get @@ -498,7 +498,7 @@ public EntityReference OnsiteCourseReference [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "FK_StudentGrade_Course", "StudentGrade")] + [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "FK_StudentGrade_Course", "StudentGrade")] public EntityCollection StudentGrades { get @@ -519,7 +519,7 @@ public EntityCollection StudentGrades [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "CourseInstructor", "Person")] + [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "CourseInstructor", "Person")] public EntityCollection People { get @@ -536,7 +536,7 @@ public EntityCollection People } #endregion } - + /// /// No Metadata Documentation available. /// @@ -557,13 +557,13 @@ public static Department CreateDepartment(global::System.Int32 departmentID, glo { Department department = new Department(); department.DepartmentID = departmentID; - + department.Name = name; - + department.Budget = budget; - + department.StartDate = startDate; - + return department; } #endregion @@ -591,12 +591,12 @@ public static Department CreateDepartment(global::System.Int32 departmentID, glo OnDepartmentIDChanged(); } } - + } private global::System.Int32 _DepartmentID; partial void OnDepartmentIDChanging(global::System.Int32 value); partial void OnDepartmentIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -616,12 +616,12 @@ public static Department CreateDepartment(global::System.Int32 departmentID, glo ReportPropertyChanged("Name"); OnNameChanged(); } - + } private global::System.String _Name; partial void OnNameChanging(global::System.String value); partial void OnNameChanged(); - + /// /// No Metadata Documentation available. /// @@ -641,12 +641,12 @@ public static Department CreateDepartment(global::System.Int32 departmentID, glo ReportPropertyChanged("Budget"); OnBudgetChanged(); } - + } private global::System.Decimal _Budget; partial void OnBudgetChanging(global::System.Decimal value); partial void OnBudgetChanged(); - + /// /// No Metadata Documentation available. /// @@ -666,12 +666,12 @@ public static Department CreateDepartment(global::System.Int32 departmentID, glo ReportPropertyChanged("StartDate"); OnStartDateChanged(); } - + } private global::System.DateTime _StartDate; partial void OnStartDateChanging(global::System.DateTime value); partial void OnStartDateChanged(); - + /// /// No Metadata Documentation available. /// @@ -691,14 +691,14 @@ public static Department CreateDepartment(global::System.Int32 departmentID, glo ReportPropertyChanged("Administrator"); OnAdministratorChanged(); } - + } private Nullable _Administrator; partial void OnAdministratorChanging(Nullable value); partial void OnAdministratorChanged(); - + #endregion - + #region Navigation Properties /// /// No Metadata Documentation available. @@ -706,7 +706,7 @@ public static Department CreateDepartment(global::System.Int32 departmentID, glo [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "FK_Course_Department", "Course")] + [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "FK_Course_Department", "Course")] public EntityCollection Courses { get @@ -723,7 +723,7 @@ public EntityCollection Courses } #endregion } - + /// /// No Metadata Documentation available. /// @@ -743,11 +743,11 @@ public static OfficeAssignment CreateOfficeAssignment(global::System.Int32 instr { OfficeAssignment officeAssignment = new OfficeAssignment(); officeAssignment.InstructorID = instructorID; - + officeAssignment.Location = location; - + officeAssignment.Timestamp = timestamp; - + return officeAssignment; } #endregion @@ -775,12 +775,12 @@ public static OfficeAssignment CreateOfficeAssignment(global::System.Int32 instr OnInstructorIDChanged(); } } - + } private global::System.Int32 _InstructorID; partial void OnInstructorIDChanging(global::System.Int32 value); partial void OnInstructorIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -800,12 +800,12 @@ public static OfficeAssignment CreateOfficeAssignment(global::System.Int32 instr ReportPropertyChanged("Location"); OnLocationChanged(); } - + } private global::System.String _Location; partial void OnLocationChanging(global::System.String value); partial void OnLocationChanged(); - + /// /// No Metadata Documentation available. /// @@ -825,14 +825,14 @@ public static OfficeAssignment CreateOfficeAssignment(global::System.Int32 instr ReportPropertyChanged("Timestamp"); OnTimestampChanged(); } - + } private global::System.Byte[] _Timestamp; partial void OnTimestampChanging(global::System.Byte[] value); partial void OnTimestampChanged(); - + #endregion - + #region Navigation Properties /// /// No Metadata Documentation available. @@ -840,7 +840,7 @@ public static OfficeAssignment CreateOfficeAssignment(global::System.Int32 instr [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "FK_OfficeAssignment_Person", "Person")] + [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "FK_OfficeAssignment_Person", "Person")] public Person Person { get @@ -873,7 +873,7 @@ public EntityReference PersonReference } #endregion } - + /// /// No Metadata Documentation available. /// @@ -892,9 +892,9 @@ public static OnlineCourse CreateOnlineCourse(global::System.Int32 courseID, glo { OnlineCourse onlineCourse = new OnlineCourse(); onlineCourse.CourseID = courseID; - + onlineCourse.URL = uRL; - + return onlineCourse; } #endregion @@ -922,12 +922,12 @@ public static OnlineCourse CreateOnlineCourse(global::System.Int32 courseID, glo OnCourseIDChanged(); } } - + } private global::System.Int32 _CourseID; partial void OnCourseIDChanging(global::System.Int32 value); partial void OnCourseIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -947,14 +947,14 @@ public static OnlineCourse CreateOnlineCourse(global::System.Int32 courseID, glo ReportPropertyChanged("URL"); OnURLChanged(); } - + } private global::System.String _URL; partial void OnURLChanging(global::System.String value); partial void OnURLChanged(); - + #endregion - + #region Navigation Properties /// /// No Metadata Documentation available. @@ -962,7 +962,7 @@ public static OnlineCourse CreateOnlineCourse(global::System.Int32 courseID, glo [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "FK_OnlineCourse_Course", "Course")] + [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "FK_OnlineCourse_Course", "Course")] public Course Course { get @@ -995,7 +995,7 @@ public EntityReference CourseReference } #endregion } - + /// /// No Metadata Documentation available. /// @@ -1016,13 +1016,13 @@ public static OnsiteCourse CreateOnsiteCourse(global::System.Int32 courseID, glo { OnsiteCourse onsiteCourse = new OnsiteCourse(); onsiteCourse.CourseID = courseID; - + onsiteCourse.Location = location; - + onsiteCourse.Days = days; - + onsiteCourse.Time = time; - + return onsiteCourse; } #endregion @@ -1050,12 +1050,12 @@ public static OnsiteCourse CreateOnsiteCourse(global::System.Int32 courseID, glo OnCourseIDChanged(); } } - + } private global::System.Int32 _CourseID; partial void OnCourseIDChanging(global::System.Int32 value); partial void OnCourseIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1075,12 +1075,12 @@ public static OnsiteCourse CreateOnsiteCourse(global::System.Int32 courseID, glo ReportPropertyChanged("Location"); OnLocationChanged(); } - + } private global::System.String _Location; partial void OnLocationChanging(global::System.String value); partial void OnLocationChanged(); - + /// /// No Metadata Documentation available. /// @@ -1100,12 +1100,12 @@ public static OnsiteCourse CreateOnsiteCourse(global::System.Int32 courseID, glo ReportPropertyChanged("Days"); OnDaysChanged(); } - + } private global::System.String _Days; partial void OnDaysChanging(global::System.String value); partial void OnDaysChanged(); - + /// /// No Metadata Documentation available. /// @@ -1125,14 +1125,14 @@ public static OnsiteCourse CreateOnsiteCourse(global::System.Int32 courseID, glo ReportPropertyChanged("Time"); OnTimeChanged(); } - + } private global::System.DateTime _Time; partial void OnTimeChanging(global::System.DateTime value); partial void OnTimeChanged(); - + #endregion - + #region Navigation Properties /// /// No Metadata Documentation available. @@ -1140,7 +1140,7 @@ public static OnsiteCourse CreateOnsiteCourse(global::System.Int32 courseID, glo [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "FK_OnsiteCourse_Course", "Course")] + [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "FK_OnsiteCourse_Course", "Course")] public Course Course { get @@ -1173,7 +1173,7 @@ public EntityReference CourseReference } #endregion } - + /// /// No Metadata Documentation available. /// @@ -1193,11 +1193,11 @@ public static Person CreatePerson(global::System.Int32 personID, global::System. { Person person = new Person(); person.PersonID = personID; - + person.LastName = lastName; - + person.FirstName = firstName; - + return person; } #endregion @@ -1225,12 +1225,12 @@ public static Person CreatePerson(global::System.Int32 personID, global::System. OnPersonIDChanged(); } } - + } private global::System.Int32 _PersonID; partial void OnPersonIDChanging(global::System.Int32 value); partial void OnPersonIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1250,12 +1250,12 @@ public static Person CreatePerson(global::System.Int32 personID, global::System. ReportPropertyChanged("LastName"); OnLastNameChanged(); } - + } private global::System.String _LastName; partial void OnLastNameChanging(global::System.String value); partial void OnLastNameChanged(); - + /// /// No Metadata Documentation available. /// @@ -1275,12 +1275,12 @@ public static Person CreatePerson(global::System.Int32 personID, global::System. ReportPropertyChanged("FirstName"); OnFirstNameChanged(); } - + } private global::System.String _FirstName; partial void OnFirstNameChanging(global::System.String value); partial void OnFirstNameChanged(); - + /// /// No Metadata Documentation available. /// @@ -1300,12 +1300,12 @@ public static Person CreatePerson(global::System.Int32 personID, global::System. ReportPropertyChanged("HireDate"); OnHireDateChanged(); } - + } private Nullable _HireDate; partial void OnHireDateChanging(Nullable value); partial void OnHireDateChanged(); - + /// /// No Metadata Documentation available. /// @@ -1325,14 +1325,14 @@ public static Person CreatePerson(global::System.Int32 personID, global::System. ReportPropertyChanged("EnrollmentDate"); OnEnrollmentDateChanged(); } - + } private Nullable _EnrollmentDate; partial void OnEnrollmentDateChanging(Nullable value); partial void OnEnrollmentDateChanged(); - + #endregion - + #region Navigation Properties /// /// No Metadata Documentation available. @@ -1340,7 +1340,7 @@ public static Person CreatePerson(global::System.Int32 personID, global::System. [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "FK_OfficeAssignment_Person", "OfficeAssignment")] + [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "FK_OfficeAssignment_Person", "OfficeAssignment")] public OfficeAssignment OfficeAssignment { get @@ -1377,7 +1377,7 @@ public EntityReference OfficeAssignmentReference [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "FK_StudentGrade_Student", "StudentGrade")] + [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "FK_StudentGrade_Student", "StudentGrade")] public EntityCollection StudentGrades { get @@ -1398,7 +1398,7 @@ public EntityCollection StudentGrades [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "CourseInstructor", "Course")] + [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "CourseInstructor", "Course")] public EntityCollection Courses { get @@ -1415,7 +1415,7 @@ public EntityCollection Courses } #endregion } - + /// /// No Metadata Documentation available. /// @@ -1435,11 +1435,11 @@ public static StudentGrade CreateStudentGrade(global::System.Int32 enrollmentID, { StudentGrade studentGrade = new StudentGrade(); studentGrade.EnrollmentID = enrollmentID; - + studentGrade.CourseID = courseID; - + studentGrade.StudentID = studentID; - + return studentGrade; } #endregion @@ -1467,12 +1467,12 @@ public static StudentGrade CreateStudentGrade(global::System.Int32 enrollmentID, OnEnrollmentIDChanged(); } } - + } private global::System.Int32 _EnrollmentID; partial void OnEnrollmentIDChanging(global::System.Int32 value); partial void OnEnrollmentIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1492,12 +1492,12 @@ public static StudentGrade CreateStudentGrade(global::System.Int32 enrollmentID, ReportPropertyChanged("CourseID"); OnCourseIDChanged(); } - + } private global::System.Int32 _CourseID; partial void OnCourseIDChanging(global::System.Int32 value); partial void OnCourseIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1517,12 +1517,12 @@ public static StudentGrade CreateStudentGrade(global::System.Int32 enrollmentID, ReportPropertyChanged("StudentID"); OnStudentIDChanged(); } - + } private global::System.Int32 _StudentID; partial void OnStudentIDChanging(global::System.Int32 value); partial void OnStudentIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1542,14 +1542,14 @@ public static StudentGrade CreateStudentGrade(global::System.Int32 enrollmentID, ReportPropertyChanged("Grade"); OnGradeChanged(); } - + } private Nullable _Grade; partial void OnGradeChanging(Nullable value); partial void OnGradeChanged(); - + #endregion - + #region Navigation Properties /// /// No Metadata Documentation available. @@ -1557,7 +1557,7 @@ public static StudentGrade CreateStudentGrade(global::System.Int32 enrollmentID, [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "FK_StudentGrade_Course", "Course")] + [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "FK_StudentGrade_Course", "Course")] public Course Course { get @@ -1594,7 +1594,7 @@ public EntityReference CourseReference [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] - [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "FK_StudentGrade_Student", "Person")] + [EdmRelationshipNavigationPropertyAttribute("SchoolModel", "FK_StudentGrade_Student", "Person")] public Person Person { get @@ -1627,7 +1627,7 @@ public EntityReference PersonReference } #endregion } - + #endregion - + } diff --git a/samples/snippets/csharp/VS_Snippets_Misc/astoria_custom_feeds/cs/default.aspx.designer.cs b/samples/snippets/csharp/VS_Snippets_Misc/astoria_custom_feeds/cs/default.aspx.designer.cs index da5e89c820e42..082e9f0f419a6 100644 --- a/samples/snippets/csharp/VS_Snippets_Misc/astoria_custom_feeds/cs/default.aspx.designer.cs +++ b/samples/snippets/csharp/VS_Snippets_Misc/astoria_custom_feeds/cs/default.aspx.designer.cs @@ -3,15 +3,15 @@ // This code was generated by a tool. // // Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. +// the code is regenerated. // //------------------------------------------------------------------------------ namespace NorthwindService { - - + + public partial class _Default { - + /// /// form1 control. /// diff --git a/samples/snippets/csharp/VS_Snippets_Misc/astoria_custom_feeds/cs/iupdatable.cs b/samples/snippets/csharp/VS_Snippets_Misc/astoria_custom_feeds/cs/iupdatable.cs index 064a60925adc1..74c4cd5917818 100644 --- a/samples/snippets/csharp/VS_Snippets_Misc/astoria_custom_feeds/cs/iupdatable.cs +++ b/samples/snippets/csharp/VS_Snippets_Misc/astoria_custom_feeds/cs/iupdatable.cs @@ -96,7 +96,7 @@ void IUpdatable.SaveChanges() // "The save changes functionality is not supported by this in-memory provider"); } - // Returns the actual instance of the resource represented + // Returns the actual instance of the resource represented // by the resource object. object IUpdatable.ResolveResource(object resource) { diff --git a/samples/snippets/csharp/VS_Snippets_Misc/astoria_custom_feeds/cs/northwind.designer.cs b/samples/snippets/csharp/VS_Snippets_Misc/astoria_custom_feeds/cs/northwind.designer.cs index 2d36e85c82075..f488161dc24c2 100644 --- a/samples/snippets/csharp/VS_Snippets_Misc/astoria_custom_feeds/cs/northwind.designer.cs +++ b/samples/snippets/csharp/VS_Snippets_Misc/astoria_custom_feeds/cs/northwind.designer.cs @@ -27,14 +27,14 @@ namespace NorthwindModel { #region Contexts - + /// /// No Metadata Documentation available. /// public partial class NorthwindEntities : ObjectContext { #region Constructors - + /// /// Initializes a new NorthwindEntities object using the connection string found in the 'NorthwindEntities' section of the application configuration file. /// @@ -43,7 +43,7 @@ public NorthwindEntities() : base("name=NorthwindEntities", "NorthwindEntities") this.ContextOptions.LazyLoadingEnabled = true; OnContextCreated(); } - + /// /// Initialize a new NorthwindEntities object. /// @@ -52,7 +52,7 @@ public NorthwindEntities(string connectionString) : base(connectionString, "Nort this.ContextOptions.LazyLoadingEnabled = true; OnContextCreated(); } - + /// /// Initialize a new NorthwindEntities object. /// @@ -61,17 +61,17 @@ public NorthwindEntities(EntityConnection connection) : base(connection, "Northw this.ContextOptions.LazyLoadingEnabled = true; OnContextCreated(); } - + #endregion - + #region Partial Methods - + partial void OnContextCreated(); - + #endregion - + #region ObjectSet Properties - + /// /// No Metadata Documentation available. /// @@ -87,7 +87,7 @@ public ObjectSet Customers } } private ObjectSet _Customers; - + /// /// No Metadata Documentation available. /// @@ -103,7 +103,7 @@ public ObjectSet Order_Details } } private ObjectSet _Order_Details; - + /// /// No Metadata Documentation available. /// @@ -119,7 +119,7 @@ public ObjectSet Orders } } private ObjectSet _Orders; - + /// /// No Metadata Documentation available. /// @@ -138,7 +138,7 @@ public ObjectSet Products #endregion #region AddTo Methods - + /// /// Deprecated Method for adding a new object to the Customers EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// @@ -146,7 +146,7 @@ public void AddToCustomers(Customer customer) { base.AddObject("Customers", customer); } - + /// /// Deprecated Method for adding a new object to the Order_Details EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// @@ -154,7 +154,7 @@ public void AddToOrder_Details(Order_Detail order_Detail) { base.AddObject("Order_Details", order_Detail); } - + /// /// Deprecated Method for adding a new object to the Orders EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// @@ -162,7 +162,7 @@ public void AddToOrders(Order order) { base.AddObject("Orders", order); } - + /// /// Deprecated Method for adding a new object to the Products EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// @@ -173,12 +173,12 @@ public void AddToProducts(Product product) #endregion } - + #endregion - + #region Entities - + /// /// No Metadata Documentation available. /// @@ -188,7 +188,7 @@ public void AddToProducts(Product product) public partial class Customer : EntityObject { #region Factory Method - + /// /// Create a new Customer object. /// @@ -204,7 +204,7 @@ public static Customer CreateCustomer(global::System.String customerID, global:: #endregion #region Primitive Properties - + /// /// No Metadata Documentation available. /// @@ -231,7 +231,7 @@ public static Customer CreateCustomer(global::System.String customerID, global:: private global::System.String _CustomerID; partial void OnCustomerIDChanging(global::System.String value); partial void OnCustomerIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -255,7 +255,7 @@ public static Customer CreateCustomer(global::System.String customerID, global:: private global::System.String _ContactName; partial void OnContactNameChanging(global::System.String value); partial void OnContactNameChanged(); - + /// /// No Metadata Documentation available. /// @@ -279,7 +279,7 @@ public static Customer CreateCustomer(global::System.String customerID, global:: private global::System.String _CompanyName; partial void OnCompanyNameChanging(global::System.String value); partial void OnCompanyNameChanged(); - + /// /// No Metadata Documentation available. /// @@ -303,7 +303,7 @@ public static Customer CreateCustomer(global::System.String customerID, global:: private global::System.String _ContactTitle; partial void OnContactTitleChanging(global::System.String value); partial void OnContactTitleChanged(); - + /// /// No Metadata Documentation available. /// @@ -327,7 +327,7 @@ public static Customer CreateCustomer(global::System.String customerID, global:: private global::System.String _Address; partial void OnAddressChanging(global::System.String value); partial void OnAddressChanged(); - + /// /// No Metadata Documentation available. /// @@ -351,7 +351,7 @@ public static Customer CreateCustomer(global::System.String customerID, global:: private global::System.String _City; partial void OnCityChanging(global::System.String value); partial void OnCityChanged(); - + /// /// No Metadata Documentation available. /// @@ -375,7 +375,7 @@ public static Customer CreateCustomer(global::System.String customerID, global:: private global::System.String _Region; partial void OnRegionChanging(global::System.String value); partial void OnRegionChanged(); - + /// /// No Metadata Documentation available. /// @@ -399,7 +399,7 @@ public static Customer CreateCustomer(global::System.String customerID, global:: private global::System.String _PostalCode; partial void OnPostalCodeChanging(global::System.String value); partial void OnPostalCodeChanged(); - + /// /// No Metadata Documentation available. /// @@ -423,7 +423,7 @@ public static Customer CreateCustomer(global::System.String customerID, global:: private global::System.String _Country; partial void OnCountryChanging(global::System.String value); partial void OnCountryChanged(); - + /// /// No Metadata Documentation available. /// @@ -447,7 +447,7 @@ public static Customer CreateCustomer(global::System.String customerID, global:: private global::System.String _Phone; partial void OnPhoneChanging(global::System.String value); partial void OnPhoneChanged(); - + /// /// No Metadata Documentation available. /// @@ -473,9 +473,9 @@ public static Customer CreateCustomer(global::System.String customerID, global:: partial void OnFaxChanged(); #endregion - + #region Navigation Properties - + /// /// No Metadata Documentation available. /// @@ -500,7 +500,7 @@ public EntityCollection Orders #endregion } - + /// /// No Metadata Documentation available. /// @@ -510,7 +510,7 @@ public EntityCollection Orders public partial class Order : EntityObject { #region Factory Method - + /// /// Create a new Order object. /// @@ -524,7 +524,7 @@ public static Order CreateOrder(global::System.Int32 orderID) #endregion #region Primitive Properties - + /// /// No Metadata Documentation available. /// @@ -551,7 +551,7 @@ public static Order CreateOrder(global::System.Int32 orderID) private global::System.Int32 _OrderID; partial void OnOrderIDChanging(global::System.Int32 value); partial void OnOrderIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -575,7 +575,7 @@ public static Order CreateOrder(global::System.Int32 orderID) private global::System.String _CustomerID; partial void OnCustomerIDChanging(global::System.String value); partial void OnCustomerIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -599,7 +599,7 @@ public static Order CreateOrder(global::System.Int32 orderID) private Nullable _EmployeeID; partial void OnEmployeeIDChanging(Nullable value); partial void OnEmployeeIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -623,7 +623,7 @@ public static Order CreateOrder(global::System.Int32 orderID) private Nullable _OrderDate; partial void OnOrderDateChanging(Nullable value); partial void OnOrderDateChanged(); - + /// /// No Metadata Documentation available. /// @@ -647,7 +647,7 @@ public static Order CreateOrder(global::System.Int32 orderID) private Nullable _RequiredDate; partial void OnRequiredDateChanging(Nullable value); partial void OnRequiredDateChanged(); - + /// /// No Metadata Documentation available. /// @@ -671,7 +671,7 @@ public static Order CreateOrder(global::System.Int32 orderID) private Nullable _ShippedDate; partial void OnShippedDateChanging(Nullable value); partial void OnShippedDateChanged(); - + /// /// No Metadata Documentation available. /// @@ -695,7 +695,7 @@ public static Order CreateOrder(global::System.Int32 orderID) private Nullable _ShipVia; partial void OnShipViaChanging(Nullable value); partial void OnShipViaChanged(); - + /// /// No Metadata Documentation available. /// @@ -719,7 +719,7 @@ public static Order CreateOrder(global::System.Int32 orderID) private Nullable _Freight; partial void OnFreightChanging(Nullable value); partial void OnFreightChanged(); - + /// /// No Metadata Documentation available. /// @@ -743,7 +743,7 @@ public static Order CreateOrder(global::System.Int32 orderID) private global::System.String _ShipName; partial void OnShipNameChanging(global::System.String value); partial void OnShipNameChanged(); - + /// /// No Metadata Documentation available. /// @@ -767,7 +767,7 @@ public static Order CreateOrder(global::System.Int32 orderID) private global::System.String _ShipAddress; partial void OnShipAddressChanging(global::System.String value); partial void OnShipAddressChanged(); - + /// /// No Metadata Documentation available. /// @@ -791,7 +791,7 @@ public static Order CreateOrder(global::System.Int32 orderID) private global::System.String _ShipCity; partial void OnShipCityChanging(global::System.String value); partial void OnShipCityChanged(); - + /// /// No Metadata Documentation available. /// @@ -815,7 +815,7 @@ public static Order CreateOrder(global::System.Int32 orderID) private global::System.String _ShipRegion; partial void OnShipRegionChanging(global::System.String value); partial void OnShipRegionChanged(); - + /// /// No Metadata Documentation available. /// @@ -839,7 +839,7 @@ public static Order CreateOrder(global::System.Int32 orderID) private global::System.String _ShipPostalCode; partial void OnShipPostalCodeChanging(global::System.String value); partial void OnShipPostalCodeChanged(); - + /// /// No Metadata Documentation available. /// @@ -865,9 +865,9 @@ public static Order CreateOrder(global::System.Int32 orderID) partial void OnShipCountryChanged(); #endregion - + #region Navigation Properties - + /// /// No Metadata Documentation available. /// @@ -905,7 +905,7 @@ public EntityReference CustomerReference } } } - + /// /// No Metadata Documentation available. /// @@ -930,7 +930,7 @@ public EntityCollection Order_Details #endregion } - + /// /// No Metadata Documentation available. /// @@ -940,7 +940,7 @@ public EntityCollection Order_Details public partial class Order_Detail : EntityObject { #region Factory Method - + /// /// Create a new Order_Detail object. /// @@ -962,7 +962,7 @@ public static Order_Detail CreateOrder_Detail(global::System.Int32 orderID, glob #endregion #region Primitive Properties - + /// /// No Metadata Documentation available. /// @@ -989,7 +989,7 @@ public static Order_Detail CreateOrder_Detail(global::System.Int32 orderID, glob private global::System.Int32 _OrderID; partial void OnOrderIDChanging(global::System.Int32 value); partial void OnOrderIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1016,7 +1016,7 @@ public static Order_Detail CreateOrder_Detail(global::System.Int32 orderID, glob private global::System.Int32 _ProductID; partial void OnProductIDChanging(global::System.Int32 value); partial void OnProductIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1040,7 +1040,7 @@ public static Order_Detail CreateOrder_Detail(global::System.Int32 orderID, glob private global::System.Decimal _UnitPrice; partial void OnUnitPriceChanging(global::System.Decimal value); partial void OnUnitPriceChanged(); - + /// /// No Metadata Documentation available. /// @@ -1064,7 +1064,7 @@ public static Order_Detail CreateOrder_Detail(global::System.Int32 orderID, glob private global::System.Int16 _Quantity; partial void OnQuantityChanging(global::System.Int16 value); partial void OnQuantityChanged(); - + /// /// No Metadata Documentation available. /// @@ -1090,9 +1090,9 @@ public static Order_Detail CreateOrder_Detail(global::System.Int32 orderID, glob partial void OnDiscountChanged(); #endregion - + #region Navigation Properties - + /// /// No Metadata Documentation available. /// @@ -1130,7 +1130,7 @@ public EntityReference OrderReference } } } - + /// /// No Metadata Documentation available. /// @@ -1171,7 +1171,7 @@ public EntityReference ProductReference #endregion } - + /// /// No Metadata Documentation available. /// @@ -1181,7 +1181,7 @@ public EntityReference ProductReference public partial class Product : EntityObject { #region Factory Method - + /// /// Create a new Product object. /// @@ -1199,7 +1199,7 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst #endregion #region Primitive Properties - + /// /// No Metadata Documentation available. /// @@ -1226,7 +1226,7 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst private global::System.Int32 _ProductID; partial void OnProductIDChanging(global::System.Int32 value); partial void OnProductIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1250,7 +1250,7 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst private global::System.String _ProductName; partial void OnProductNameChanging(global::System.String value); partial void OnProductNameChanged(); - + /// /// No Metadata Documentation available. /// @@ -1274,7 +1274,7 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst private Nullable _UnitsInStock; partial void OnUnitsInStockChanging(Nullable value); partial void OnUnitsInStockChanged(); - + /// /// No Metadata Documentation available. /// @@ -1298,7 +1298,7 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst private Nullable _ReorderLevel; partial void OnReorderLevelChanging(Nullable value); partial void OnReorderLevelChanged(); - + /// /// No Metadata Documentation available. /// @@ -1322,7 +1322,7 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst private Nullable _SupplierID; partial void OnSupplierIDChanging(Nullable value); partial void OnSupplierIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1346,7 +1346,7 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst private Nullable _CategoryID; partial void OnCategoryIDChanging(Nullable value); partial void OnCategoryIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1370,7 +1370,7 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst private global::System.String _QuantityPerUnit; partial void OnQuantityPerUnitChanging(global::System.String value); partial void OnQuantityPerUnitChanged(); - + /// /// No Metadata Documentation available. /// @@ -1394,7 +1394,7 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst private Nullable _UnitPrice; partial void OnUnitPriceChanging(Nullable value); partial void OnUnitPriceChanged(); - + /// /// No Metadata Documentation available. /// @@ -1418,7 +1418,7 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst private Nullable _UnitsOnOrder; partial void OnUnitsOnOrderChanging(Nullable value); partial void OnUnitsOnOrderChanged(); - + /// /// No Metadata Documentation available. /// @@ -1444,9 +1444,9 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst partial void OnDiscontinuedChanged(); #endregion - + #region Navigation Properties - + /// /// No Metadata Documentation available. /// @@ -1473,5 +1473,5 @@ public EntityCollection Order_Details } #endregion - + } diff --git a/samples/snippets/csharp/VS_Snippets_Misc/astoria_custom_feeds/cs/northwind.objects.cs b/samples/snippets/csharp/VS_Snippets_Misc/astoria_custom_feeds/cs/northwind.objects.cs index 68038bc2fb838..310866cca99c2 100644 --- a/samples/snippets/csharp/VS_Snippets_Misc/astoria_custom_feeds/cs/northwind.objects.cs +++ b/samples/snippets/csharp/VS_Snippets_Misc/astoria_custom_feeds/cs/northwind.objects.cs @@ -17,7 +17,7 @@ // Generation date: 7/20/2009 11:57:04 PM namespace NorthwindService { - + /// /// There are no comments for NorthwindEntities in the schema. /// @@ -26,7 +26,7 @@ public partial class NorthwindEntities : global::System.Data.Objects.ObjectConte /// /// Initializes a new NorthwindEntities object using the connection string found in the 'NorthwindEntities' section of the application configuration file. /// - public NorthwindEntities() : + public NorthwindEntities() : base("name=NorthwindEntities", "NorthwindEntities") { this.OnContextCreated(); @@ -34,7 +34,7 @@ public NorthwindEntities() : /// /// Initialize a new NorthwindEntities object. /// - public NorthwindEntities(string connectionString) : + public NorthwindEntities(string connectionString) : base(connectionString, "NorthwindEntities") { this.OnContextCreated(); @@ -42,7 +42,7 @@ public NorthwindEntities(string connectionString) : /// /// Initialize a new NorthwindEntities object. /// - public NorthwindEntities(global::System.Data.EntityClient.EntityConnection connection) : + public NorthwindEntities(global::System.Data.EntityClient.EntityConnection connection) : base(connection, "NorthwindEntities") { this.OnContextCreated(); diff --git a/samples/snippets/csharp/VS_Snippets_Misc/astoria_custom_feeds/cs/northwind.svc.cs b/samples/snippets/csharp/VS_Snippets_Misc/astoria_custom_feeds/cs/northwind.svc.cs index aa442356cc6bd..7688ab3e9232d 100644 --- a/samples/snippets/csharp/VS_Snippets_Misc/astoria_custom_feeds/cs/northwind.svc.cs +++ b/samples/snippets/csharp/VS_Snippets_Misc/astoria_custom_feeds/cs/northwind.svc.cs @@ -7,7 +7,7 @@ namespace NorthwindService { - [System.ServiceModel.ServiceBehavior(IncludeExceptionDetailInFaults = true)] + [System.ServiceModel.ServiceBehavior(IncludeExceptionDetailInFaults = true)] public class Northwind : DataService { // This method is called only once to initialize service-wide policies. @@ -16,7 +16,7 @@ public static void InitializeService(DataServiceConfiguration config) // TODO: set rules to indicate which entity sets and service operations are visible, updatable, etc. // Examples: config.SetEntitySetAccessRule("*", EntitySetRights.All); - config.DataServiceBehavior.MaxProtocolVersion = + config.DataServiceBehavior.MaxProtocolVersion = System.Data.Services.Common.DataServiceProtocolVersion.V2; // config.SetServiceOperationAccessRule("MyServiceOperation", ServiceOperationRights.All); } diff --git a/samples/snippets/csharp/VS_Snippets_Misc/astoria_custom_feeds/cs/orderitems.svc.cs b/samples/snippets/csharp/VS_Snippets_Misc/astoria_custom_feeds/cs/orderitems.svc.cs index d5b6c369d1a29..e58c0cf9cf381 100644 --- a/samples/snippets/csharp/VS_Snippets_Misc/astoria_custom_feeds/cs/orderitems.svc.cs +++ b/samples/snippets/csharp/VS_Snippets_Misc/astoria_custom_feeds/cs/orderitems.svc.cs @@ -8,11 +8,11 @@ namespace CustomDataService { // - [EntityPropertyMappingAttribute("Customer", + [EntityPropertyMappingAttribute("Customer", SyndicationItemProperty.AuthorName, SyndicationTextContentKind.Plaintext, true)] - [EntityPropertyMapping("OrderId", - SyndicationItemProperty.Title, + [EntityPropertyMapping("OrderId", + SyndicationItemProperty.Title, SyndicationTextContentKind.Plaintext, false)] [DataServiceKeyAttribute("OrderId")] public class Order @@ -74,7 +74,7 @@ public static void InitializeService(DataServiceConfiguration config.SetEntitySetAccessRule("Items", EntitySetRights.AllRead | EntitySetRights.AllWrite); - config.DataServiceBehavior.MaxProtocolVersion = + config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2; } } diff --git a/samples/snippets/csharp/VS_Snippets_Misc/astoria_linq_provider/cs/default.aspx.designer.cs b/samples/snippets/csharp/VS_Snippets_Misc/astoria_linq_provider/cs/default.aspx.designer.cs index 76dd04b28ceeb..0beebe50f7ab4 100644 --- a/samples/snippets/csharp/VS_Snippets_Misc/astoria_linq_provider/cs/default.aspx.designer.cs +++ b/samples/snippets/csharp/VS_Snippets_Misc/astoria_linq_provider/cs/default.aspx.designer.cs @@ -9,10 +9,10 @@ //------------------------------------------------------------------------------ namespace NorthwindService { - - + + public partial class _Default { - + /// /// form1 control. /// diff --git a/samples/snippets/csharp/VS_Snippets_Misc/astoria_linq_provider/cs/northwind.cs b/samples/snippets/csharp/VS_Snippets_Misc/astoria_linq_provider/cs/northwind.cs index 563bacad0cb21..fd73f6906ed9e 100644 --- a/samples/snippets/csharp/VS_Snippets_Misc/astoria_linq_provider/cs/northwind.cs +++ b/samples/snippets/csharp/VS_Snippets_Misc/astoria_linq_provider/cs/northwind.cs @@ -129,7 +129,7 @@ void IUpdatable.SaveChanges() SubmitChanges(); } - // Returns the actual instance of the resource represented + // Returns the actual instance of the resource represented // by the resource object. object IUpdatable.ResolveResource(object resource) { diff --git a/samples/snippets/csharp/VS_Snippets_Misc/astoria_linq_provider/cs/northwind.designer.cs b/samples/snippets/csharp/VS_Snippets_Misc/astoria_linq_provider/cs/northwind.designer.cs index 340f76293a746..c873bc764ee4c 100644 --- a/samples/snippets/csharp/VS_Snippets_Misc/astoria_linq_provider/cs/northwind.designer.cs +++ b/samples/snippets/csharp/VS_Snippets_Misc/astoria_linq_provider/cs/northwind.designer.cs @@ -44,31 +44,31 @@ public partial class NorthwindDataContext : System.Data.Linq.DataContext partial void DeleteProduct(Product instance); #endregion - public NorthwindDataContext() : + public NorthwindDataContext() : base(global::System.Configuration.ConfigurationManager.ConnectionStrings["NorthwindConnectionString"].ConnectionString, mappingSource) { OnCreated(); } - public NorthwindDataContext(string connection) : + public NorthwindDataContext(string connection) : base(connection, mappingSource) { OnCreated(); } - public NorthwindDataContext(System.Data.IDbConnection connection) : + public NorthwindDataContext(System.Data.IDbConnection connection) : base(connection, mappingSource) { OnCreated(); } - public NorthwindDataContext(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) : + public NorthwindDataContext(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) : base(connection, mappingSource) { OnCreated(); } - public NorthwindDataContext(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : + public NorthwindDataContext(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : base(connection, mappingSource) { OnCreated(); @@ -823,7 +823,7 @@ public Customer Customer set { Customer previousValue = this._Customer.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Customer.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1041,7 +1041,7 @@ public Order Order set { Order previousValue = this._Order.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Order.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); @@ -1075,7 +1075,7 @@ public Product Product set { Product previousValue = this._Product.Entity; - if (((previousValue != value) + if (((previousValue != value) || (this._Product.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); diff --git a/samples/snippets/csharp/VS_Snippets_Misc/astoria_linq_provider/cs/northwind.svc.cs b/samples/snippets/csharp/VS_Snippets_Misc/astoria_linq_provider/cs/northwind.svc.cs index 06db4c5e329cb..76a763bdbb20a 100644 --- a/samples/snippets/csharp/VS_Snippets_Misc/astoria_linq_provider/cs/northwind.svc.cs +++ b/samples/snippets/csharp/VS_Snippets_Misc/astoria_linq_provider/cs/northwind.svc.cs @@ -15,9 +15,9 @@ public static void InitializeService(DataServiceConfiguration config) { // config.SetEntitySetAccessRule("Customers", EntitySetRights.ReadMultiple); - config.SetEntitySetAccessRule("Orders", EntitySetRights.AllRead + config.SetEntitySetAccessRule("Orders", EntitySetRights.AllRead | EntitySetRights.WriteMerge); - config.SetEntitySetAccessRule("Order_Details", EntitySetRights.AllRead + config.SetEntitySetAccessRule("Order_Details", EntitySetRights.AllRead | EntitySetRights.AllWrite); config.SetEntitySetAccessRule("Products", EntitySetRights.ReadMultiple); // @@ -52,7 +52,7 @@ public SomeType(int key, string prop) this.Key = key; this.Prop = prop; } - + public int Key {get; set;} public string Prop { get; set;} diff --git a/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/clientcredentials.xaml.cs b/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/clientcredentials.xaml.cs index ae9b9e7da08c1..808b2f85b462a 100644 --- a/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/clientcredentials.xaml.cs +++ b/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/clientcredentials.xaml.cs @@ -1,4 +1,4 @@ -// +// using System; using System.Linq; using System.Net; @@ -37,10 +37,10 @@ private void ClientCredentials_Loaded(object sender, RoutedEventArgs e) LoginWindow login = new LoginWindow(); login.ShowDialog(); - if (login.DialogResult == true + if (login.DialogResult == true && login.userNameBox.Text != string.Empty && login.passwordBox.SecurePassword.Length != 0) - { + { // Instantiate the context. context = new NorthwindEntities(serviceUri); diff --git a/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/customerorders.designer.cs b/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/customerorders.designer.cs index ff36a340ae76c..2d61bf9e8622c 100644 --- a/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/customerorders.designer.cs +++ b/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/customerorders.designer.cs @@ -33,17 +33,17 @@ private void InitializeComponent() this.customersComboBox = new System.Windows.Forms.ComboBox(); ((System.ComponentModel.ISupportInitialize)(this.ordersDataGridView)).BeginInit(); this.SuspendLayout(); - // + // // ordersDataGridView - // + // this.ordersDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.ordersDataGridView.Location = new System.Drawing.Point(29, 131); this.ordersDataGridView.Name = "ordersDataGridView"; this.ordersDataGridView.Size = new System.Drawing.Size(570, 237); this.ordersDataGridView.TabIndex = 11; - // + // // button1 - // + // this.button1.Location = new System.Drawing.Point(-290, -186); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(100, 23); @@ -51,18 +51,18 @@ private void InitializeComponent() this.button1.Text = "Save"; this.button1.UseVisualStyleBackColor = true; this.button1.Click += new System.EventHandler(this.button1_Click); - // + // // customersComboBox - // + // this.customersComboBox.FormattingEnabled = true; this.customersComboBox.Location = new System.Drawing.Point(68, 31); this.customersComboBox.Name = "customersComboBox"; this.customersComboBox.Size = new System.Drawing.Size(121, 21); this.customersComboBox.TabIndex = 13; this.customersComboBox.SelectedIndexChanged += new System.EventHandler(this.customersComboBox_SelectedIndexChanged); - // + // // CustomerOrders - // + // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(642, 388); diff --git a/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/customerorders2.cs b/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/customerorders2.cs index 071b2067ce9fe..2218ab776a803 100644 --- a/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/customerorders2.cs +++ b/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/customerorders2.cs @@ -30,7 +30,7 @@ private void CustomerOrders_Load(object sender, EventArgs e) // // Create a new collection that contains all customers and related orders. - DataServiceCollection trackedCustomers = + DataServiceCollection trackedCustomers = new DataServiceCollection(context.Customers.Expand("Orders")); // try diff --git a/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/customerorders2.designer.cs b/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/customerorders2.designer.cs index 1c4f016fea69e..3a062f4b2c761 100644 --- a/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/customerorders2.designer.cs +++ b/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/customerorders2.designer.cs @@ -65,103 +65,103 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.ordersBindingSource)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.ordersDataGridView)).BeginInit(); this.SuspendLayout(); - // + // // companyNameLabel - // + // companyNameLabel.AutoSize = true; companyNameLabel.Location = new System.Drawing.Point(42, 40); companyNameLabel.Name = "companyNameLabel"; companyNameLabel.Size = new System.Drawing.Size(85, 13); companyNameLabel.TabIndex = 1; companyNameLabel.Text = "Company Name:"; - // + // // contactNameLabel - // + // contactNameLabel.AutoSize = true; contactNameLabel.Location = new System.Drawing.Point(49, 66); contactNameLabel.Name = "contactNameLabel"; contactNameLabel.Size = new System.Drawing.Size(78, 13); contactNameLabel.TabIndex = 3; contactNameLabel.Text = "Contact Name:"; - // + // // contactTitleLabel - // + // contactTitleLabel.AutoSize = true; contactTitleLabel.Location = new System.Drawing.Point(57, 92); contactTitleLabel.Name = "contactTitleLabel"; contactTitleLabel.Size = new System.Drawing.Size(70, 13); contactTitleLabel.TabIndex = 5; contactTitleLabel.Text = "Contact Title:"; - // + // // phoneLabel - // + // phoneLabel.AutoSize = true; phoneLabel.Location = new System.Drawing.Point(282, 40); phoneLabel.Name = "phoneLabel"; phoneLabel.Size = new System.Drawing.Size(41, 13); phoneLabel.TabIndex = 7; phoneLabel.Text = "Phone:"; - // + // // faxLabel - // + // faxLabel.AutoSize = true; faxLabel.Location = new System.Drawing.Point(296, 66); faxLabel.Name = "faxLabel"; faxLabel.Size = new System.Drawing.Size(27, 13); faxLabel.TabIndex = 9; faxLabel.Text = "Fax:"; - // + // // customersBindingSource - // + // this.customersBindingSource.DataSource = typeof(Northwind.Customer); - // + // // companyNameTextBox - // + // this.companyNameTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.customersBindingSource, "CompanyName", true)); this.companyNameTextBox.Location = new System.Drawing.Point(133, 37); this.companyNameTextBox.Name = "companyNameTextBox"; this.companyNameTextBox.Size = new System.Drawing.Size(100, 20); this.companyNameTextBox.TabIndex = 2; - // + // // contactNameTextBox - // + // this.contactNameTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.customersBindingSource, "ContactName", true)); this.contactNameTextBox.Location = new System.Drawing.Point(133, 63); this.contactNameTextBox.Name = "contactNameTextBox"; this.contactNameTextBox.Size = new System.Drawing.Size(100, 20); this.contactNameTextBox.TabIndex = 4; - // + // // contactTitleTextBox - // + // this.contactTitleTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.customersBindingSource, "ContactTitle", true)); this.contactTitleTextBox.Location = new System.Drawing.Point(133, 89); this.contactTitleTextBox.Name = "contactTitleTextBox"; this.contactTitleTextBox.Size = new System.Drawing.Size(100, 20); this.contactTitleTextBox.TabIndex = 6; - // + // // phoneTextBox - // + // this.phoneTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.customersBindingSource, "Phone", true)); this.phoneTextBox.Location = new System.Drawing.Point(329, 37); this.phoneTextBox.Name = "phoneTextBox"; this.phoneTextBox.Size = new System.Drawing.Size(100, 20); this.phoneTextBox.TabIndex = 8; - // + // // faxTextBox - // + // this.faxTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.customersBindingSource, "Fax", true)); this.faxTextBox.Location = new System.Drawing.Point(329, 63); this.faxTextBox.Name = "faxTextBox"; this.faxTextBox.Size = new System.Drawing.Size(100, 20); this.faxTextBox.TabIndex = 10; - // + // // ordersBindingSource - // + // this.ordersBindingSource.DataMember = "Orders"; this.ordersBindingSource.DataSource = this.customersBindingSource; - // + // // ordersDataGridView - // + // this.ordersDataGridView.AutoGenerateColumns = false; this.ordersDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.ordersDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { @@ -182,81 +182,81 @@ private void InitializeComponent() this.ordersDataGridView.Name = "ordersDataGridView"; this.ordersDataGridView.Size = new System.Drawing.Size(570, 237); this.ordersDataGridView.TabIndex = 11; - // + // // dataGridViewTextBoxColumn1 - // + // this.dataGridViewTextBoxColumn1.DataPropertyName = "OrderID"; this.dataGridViewTextBoxColumn1.HeaderText = "OrderID"; this.dataGridViewTextBoxColumn1.Name = "dataGridViewTextBoxColumn1"; - // + // // dataGridViewTextBoxColumn2 - // + // this.dataGridViewTextBoxColumn2.DataPropertyName = "OrderDate"; this.dataGridViewTextBoxColumn2.HeaderText = "OrderDate"; this.dataGridViewTextBoxColumn2.Name = "dataGridViewTextBoxColumn2"; - // + // // dataGridViewTextBoxColumn3 - // + // this.dataGridViewTextBoxColumn3.DataPropertyName = "RequiredDate"; this.dataGridViewTextBoxColumn3.HeaderText = "RequiredDate"; this.dataGridViewTextBoxColumn3.Name = "dataGridViewTextBoxColumn3"; - // + // // dataGridViewTextBoxColumn4 - // + // this.dataGridViewTextBoxColumn4.DataPropertyName = "ShippedDate"; this.dataGridViewTextBoxColumn4.HeaderText = "ShippedDate"; this.dataGridViewTextBoxColumn4.Name = "dataGridViewTextBoxColumn4"; - // + // // dataGridViewTextBoxColumn5 - // + // this.dataGridViewTextBoxColumn5.DataPropertyName = "Freight"; this.dataGridViewTextBoxColumn5.HeaderText = "Freight"; this.dataGridViewTextBoxColumn5.Name = "dataGridViewTextBoxColumn5"; - // + // // dataGridViewTextBoxColumn6 - // + // this.dataGridViewTextBoxColumn6.DataPropertyName = "ShipName"; this.dataGridViewTextBoxColumn6.HeaderText = "ShipName"; this.dataGridViewTextBoxColumn6.Name = "dataGridViewTextBoxColumn6"; - // + // // dataGridViewTextBoxColumn7 - // + // this.dataGridViewTextBoxColumn7.DataPropertyName = "ShipAddress"; this.dataGridViewTextBoxColumn7.HeaderText = "ShipAddress"; this.dataGridViewTextBoxColumn7.Name = "dataGridViewTextBoxColumn7"; - // + // // dataGridViewTextBoxColumn8 - // + // this.dataGridViewTextBoxColumn8.DataPropertyName = "ShipCity"; this.dataGridViewTextBoxColumn8.HeaderText = "ShipCity"; this.dataGridViewTextBoxColumn8.Name = "dataGridViewTextBoxColumn8"; - // + // // dataGridViewTextBoxColumn9 - // + // this.dataGridViewTextBoxColumn9.DataPropertyName = "ShipRegion"; this.dataGridViewTextBoxColumn9.HeaderText = "ShipRegion"; this.dataGridViewTextBoxColumn9.Name = "dataGridViewTextBoxColumn9"; - // + // // dataGridViewTextBoxColumn10 - // + // this.dataGridViewTextBoxColumn10.DataPropertyName = "ShipPostalCode"; this.dataGridViewTextBoxColumn10.HeaderText = "ShipPostalCode"; this.dataGridViewTextBoxColumn10.Name = "dataGridViewTextBoxColumn10"; - // + // // dataGridViewTextBoxColumn11 - // + // this.dataGridViewTextBoxColumn11.DataPropertyName = "ShipCountry"; this.dataGridViewTextBoxColumn11.HeaderText = "ShipCountry"; this.dataGridViewTextBoxColumn11.Name = "dataGridViewTextBoxColumn11"; - // + // // dataGridViewTextBoxColumn12 - // + // this.dataGridViewTextBoxColumn12.DataPropertyName = "Customers"; this.dataGridViewTextBoxColumn12.HeaderText = "Customers"; this.dataGridViewTextBoxColumn12.Name = "dataGridViewTextBoxColumn12"; - // + // // button1 - // + // this.button1.Location = new System.Drawing.Point(329, 92); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(100, 23); @@ -264,9 +264,9 @@ private void InitializeComponent() this.button1.Text = "Save"; this.button1.UseVisualStyleBackColor = true; this.button1.Click += new System.EventHandler(this.button1_Click); - // + // // comboBox1 - // + // this.comboBox1.DataSource = this.customersBindingSource; this.comboBox1.DisplayMember = "CustomerID"; this.comboBox1.FormattingEnabled = true; @@ -275,9 +275,9 @@ private void InitializeComponent() this.comboBox1.Size = new System.Drawing.Size(121, 21); this.comboBox1.TabIndex = 13; this.comboBox1.ValueMember = "CustomerID"; - // + // // CustomerOrders - // + // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(642, 388); diff --git a/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/customerordersasync.xaml.cs b/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/customerordersasync.xaml.cs index 91134e2823292..b615968ec938f 100644 --- a/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/customerordersasync.xaml.cs +++ b/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/customerordersasync.xaml.cs @@ -26,7 +26,7 @@ public partial class CustomerOrdersAsync : Window private NorthwindEntities context; private DataServiceCollection customerBinding; private const string customerCountry = "Germany"; - + // Change this URI to the service URI for your implementation. private const string svcUri = "http://localhost:12345/Northwind.svc/"; @@ -49,7 +49,7 @@ private void Window_Loaded(object sender, RoutedEventArgs e) try { - // Begin asynchronously saving changes using the + // Begin asynchronously saving changes using the // specified handler and query object state. query.BeginExecute(OnQueryCompleted, query); } @@ -70,11 +70,11 @@ private void OnQueryCompleted(IAsyncResult result) { try { - // Instantiate the binding collection using the + // Instantiate the binding collection using the // results of the query execution. customerBinding = new DataServiceCollection( query.EndExecute(result)); - + // Bind the collection to the root element of the UI. this.LayoutRoot.DataContext = customerBinding; } diff --git a/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/customerorderscustom.xaml.cs b/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/customerorderscustom.xaml.cs index eaf5c960bd047..b45272260ddaf 100644 --- a/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/customerorderscustom.xaml.cs +++ b/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/customerorderscustom.xaml.cs @@ -44,8 +44,8 @@ private void Window_Loaded(object sender, RoutedEventArgs e) select cust; // Create a new collection for binding based on the LINQ query. - trackedCustomers = new DataServiceCollection(customerQuery, - TrackingMode.AutoChangeTracking,"Customers", + trackedCustomers = new DataServiceCollection(customerQuery, + TrackingMode.AutoChangeTracking,"Customers", OnPropertyChanged, OnCollectionChanged); // Bind the root StackPanel element to the collection; @@ -100,7 +100,7 @@ private bool OnCollectionChanged( return false; } } - else + else { // Use the default behavior. return false; @@ -111,19 +111,19 @@ private bool OnCollectionChanged( // Method that is called when the PropertyChanged event is handled. private bool OnPropertyChanged(EntityChangedParams entityChangedInfo) { - // Validate a changed order to ensure that changes are not made + // Validate a changed order to ensure that changes are not made // after the order ships. - if ((entityChangedInfo.Entity.GetType() == typeof(Order)) && + if ((entityChangedInfo.Entity.GetType() == typeof(Order)) && ((Order)(entityChangedInfo.Entity)).ShippedDate < DateTime.Today) { throw new ApplicationException(string.Format( "The order {0} cannot be changed because it shipped on {1}.", - ((Order)(entityChangedInfo.Entity)).OrderID, + ((Order)(entityChangedInfo.Entity)).OrderID, ((Order)(entityChangedInfo.Entity)).ShippedDate)); } return false; } - + private void deleteButton_Click(object sender, RoutedEventArgs e) { if (customerIDComboBox.SelectedItem != null) diff --git a/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/customerorderswpf.xaml.cs b/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/customerorderswpf.xaml.cs index 3af4785ac8d12..6dfe61eaf74b0 100644 --- a/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/customerorderswpf.xaml.cs +++ b/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/customerorderswpf.xaml.cs @@ -1,4 +1,4 @@ -// +// using System; using System.Collections.Generic; using System.Linq; diff --git a/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/customerorderswpf3.xaml.cs b/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/customerorderswpf3.xaml.cs index 24aede52d264c..e03c91b5ffb59 100644 --- a/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/customerorderswpf3.xaml.cs +++ b/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/customerorderswpf3.xaml.cs @@ -40,11 +40,11 @@ private void Window_Loaded(object sender, RoutedEventArgs e) var customerQuery = from cust in context.Customers where cust.Country == customerCountry select cust; - + // // Create a new collection for binding based on the LINQ query. trackedCustomers = new DataServiceCollection(customerQuery); - + // Load all pages of the response at once. while (trackedCustomers.Continuation != null) { @@ -66,10 +66,10 @@ private void Window_Loaded(object sender, RoutedEventArgs e) MessageBox.Show("The following error occurred:\n" + ex.ToString()); } } - + private void customerIDComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { - Customer selectedCustomer = + Customer selectedCustomer = this.customerIDComboBox.SelectedItem as Customer; try diff --git a/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/northwind.cs b/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/northwind.cs index bc94a68e92014..b87ad29447854 100644 --- a/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/northwind.cs +++ b/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/northwind.cs @@ -12,7 +12,7 @@ // Generation date: 9/27/2009 7:48:05 PM namespace NorthwindModel { - + /// /// There are no comments for NorthwindEntities in the schema. /// @@ -22,7 +22,7 @@ public partial class NorthwindEntities : global::System.Data.Services.Client.Dat /// Initialize a new NorthwindEntities object. /// [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")] - public NorthwindEntities(global::System.Uri serviceRoot) : + public NorthwindEntities(global::System.Uri serviceRoot) : base(serviceRoot) { this.OnContextCreated(); diff --git a/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/northwind1.cs b/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/northwind1.cs index 307266e04ba5c..9ceef85d23c00 100644 --- a/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/northwind1.cs +++ b/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/northwind1.cs @@ -12,7 +12,7 @@ // Generation date: 7/31/2009 1:23:06 AM namespace NorthwindModel { - + /// /// There are no comments for NorthwindEntities in the schema. /// @@ -21,7 +21,7 @@ public partial class NorthwindEntities : global::System.Data.Services.Client.Dat /// /// Initialize a new NorthwindEntities object. /// - public NorthwindEntities(global::System.Uri serviceRoot) : + public NorthwindEntities(global::System.Uri serviceRoot) : base(serviceRoot) { this.OnContextCreated(); diff --git a/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/salesorders.xaml.cs b/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/salesorders.xaml.cs index 7c95f79bef875..91e83a86086ae 100644 --- a/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/salesorders.xaml.cs +++ b/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/salesorders.xaml.cs @@ -51,13 +51,13 @@ private void OrdersForm_Loaded(object sender, RoutedEventArgs e) // Instantiate the DataServiceContext. context = new NorthwindEntities(svcUri); - // Define a query that returns Orders and + // Define a query that returns Orders and // Order_Details for a specific customer. var ordersQuery = from o in context.Orders.Expand("Order_Details") where o.Customer.CustomerID == customerId select o; - // Create an DataServiceCollection based on + // Create an DataServiceCollection based on // execution of the query for Orders. DataServiceCollection customerOrders = new DataServiceCollection(ordersQuery); diff --git a/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs b/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs index 46ed860f91879..dd4e10ffa56c9 100644 --- a/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs +++ b/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs @@ -10,7 +10,7 @@ namespace NorthwindClient { - + public class Source { public static Uri svcUri = new Uri("http://glengatest4-vm1/Northwind/Northwind.svc/"); @@ -22,7 +22,7 @@ public static void GetAllCustomers() // Create the DataServiceContext using the service URI. NorthwindEntities context = new NorthwindEntities(svcUri); - // + // // Define a new query for Customers. DataServiceQuery query = context.Customers; // @@ -96,7 +96,7 @@ public static void GetAllCustomersQuery() // Define a new query for Customers. DataServiceQuery query = context.CreateQuery("Customers"); - + try { // Enumerate over the query result. @@ -143,7 +143,7 @@ public static void BeginExecuteCustomersQuery() // Create the DataServiceContext using the service URI. NorthwindEntities context = new NorthwindEntities(svcUri); - // Define the query to execute asynchronously that returns + // Define the query to execute asynchronously that returns // all customers with their respective orders. DataServiceQuery query = (DataServiceQuery)(from cust in context.Customers.Expand("Orders") where cust.CustomerID == "ALFKI" @@ -166,7 +166,7 @@ public static void BeginExecuteCustomersQuery() private static void OnCustomersQueryComplete(IAsyncResult result) { // Get the original query from the result. - DataServiceQuery query = + DataServiceQuery query = result as DataServiceQuery; foreach (Customer customer in query.EndExecute(result)) @@ -178,7 +178,7 @@ private static void OnCustomersQueryComplete(IAsyncResult result) order.OrderID, order.Freight); } } - } + } // public static void LoadRelatedOrderCustomer() { @@ -197,7 +197,7 @@ public static void LoadRelatedOrderCustomer() // // Write out customer and order information. - Console.WriteLine("Customer: {0} - Order ID: {1}", + Console.WriteLine("Customer: {0} - Order ID: {1}", order.Customer.CompanyName, order.OrderID); } } @@ -294,7 +294,7 @@ public static void AddQueryOptions() // Enumerate over the results of the query. foreach (Order order in selectedOrders) { - Console.WriteLine("Order ID: {0} - Ship Date: {1} - Freight: {2}", + Console.WriteLine("Order ID: {0} - Ship Date: {1} - Freight: {2}", order.OrderID, order.ShippedDate, order.Freight); } } @@ -317,7 +317,7 @@ public static void AddQueryOptionsLinq() // var selectedOrders = from o in context.Orders where o.Freight > 30 - orderby o.ShippedDate descending + orderby o.ShippedDate descending select o; // @@ -357,7 +357,7 @@ public static void AddQueryOptionsLinqExpression() foreach (Order currentOrder in selectedOrders) { Console.WriteLine("Order ID: {0} - Ship Date: {1} - Freight: {2}", - currentOrder.OrderID, currentOrder.ShippedDate, + currentOrder.OrderID, currentOrder.ShippedDate, currentOrder.Freight); } } @@ -406,21 +406,21 @@ public static void BatchQuery() // Create the DataServiceContext using the service URI. NorthwindEntities context = new NorthwindEntities(svcUri); - // Create the separate query URI's, one that returns + // Create the separate query URI's, one that returns // a single customer and another that returns all Products. - Uri customerUri = new Uri(svcUri.AbsoluteUri + + Uri customerUri = new Uri(svcUri.AbsoluteUri + "/Customers('" + customerId + "')/?$expand=Orders"); Uri productsUri = new Uri(svcUri.AbsoluteUri + "/Products"); // Create the query requests. - DataServiceRequest customerQuery = + DataServiceRequest customerQuery = new DataServiceRequest(customerUri); DataServiceRequest productsQuery = new DataServiceRequest(productsUri); // Add the query requests to a batch request array. - DataServiceRequest[] batchRequests = + DataServiceRequest[] batchRequests = new DataServiceRequest[]{customerQuery, productsQuery}; DataServiceResponse batchResponse; @@ -433,7 +433,7 @@ public static void BatchQuery() if (batchResponse.IsBatchResponse) { // Parse the batchResponse.BatchHeaders. - } + } // Enumerate over the results of the query. foreach (QueryOperationResponse response in batchResponse) { @@ -500,9 +500,9 @@ public static void AttachObject() NorthwindEntities context = new NorthwindEntities(svcUri); // Define an existing customer to attach, including the key. - Customer customer = + Customer customer = Customer.CreateCustomer("ALFKI", "Alfreds Futterkiste"); - + // Set current property values. customer.Address = "Obere Str. 57"; customer.City = "Berlin"; @@ -524,7 +524,7 @@ public static void AttachObject() // Send updates to the data service. context.SaveChanges(); - // + // } catch (DataServiceClientException ex) { @@ -538,7 +538,7 @@ public static void AddProduct() // // Create the DataServiceContext using the service URI. NorthwindEntities context = new NorthwindEntities(svcUri); - + // // Create the new product. Product newProduct = @@ -555,7 +555,7 @@ public static void AddProduct() // // Add the new product to the Products entity set. context.AddToProducts(newProduct); - // + // // Send the insert to the data service. DataServiceResponse response = context.SaveChanges(); @@ -603,7 +603,7 @@ public static void ModifyCustomer() var customerToChange = (from customer in context.Customers where customer.CustomerID == customerId select customer).Single(); - + // Change some property values. customerToChange.CompanyName = "Alfreds Futterkiste"; customerToChange.ContactName = "Maria Anders"; @@ -614,7 +614,7 @@ public static void ModifyCustomer() // // Mark the customer as updated. context.UpdateObject(customerToChange); - // + // // Send the update to the data service. context.SaveChanges(); @@ -650,16 +650,16 @@ public static void DeleteProduct() where product.ProductID == productID select product).Single(); - // - // Mark the product for deletion. + // + // Mark the product for deletion. context.DeleteObject(deletedProduct); - // + // // Send the delete to the data service. context.SaveChanges(); } // Handle the error that occurs when the delete operation fails, - // which can happen when there are entities with existing + // which can happen when there are entities with existing // relationships to the product being deleted. catch (DataServiceRequestException ex) { @@ -691,7 +691,7 @@ public static void AddOrderDetailToOrder() where customer.CustomerID == customerId select customer).Single(); - // Get the first order. + // Get the first order. Order order = cust.Orders.FirstOrDefault(); // Create a new order detail for the specific product. @@ -740,7 +740,7 @@ public static void AddOrderDetailToOrder() "An error occurred when saving changes.", ex); } - // Handle any errors that may occur during insert, such as + // Handle any errors that may occur during insert, such as // a constraint violation. catch (DataServiceRequestException ex) { @@ -755,7 +755,7 @@ public static void AddOrderDetailToOrder() context.SaveChanges(); } } - + public static void AddOrderDetailToOrderAuto() { // @@ -779,7 +779,7 @@ public static void AddOrderDetailToOrderAuto() where customer.CustomerID == customerId select customer).Single(); - // Get the first order. + // Get the first order. Order order = cust.Orders.FirstOrDefault(); // Create a new order detail for the specific product. @@ -798,7 +798,7 @@ public static void AddOrderDetailToOrderAuto() newItem.Order = order; newItem.Product = selectedProduct; // - + // Send the changes to the data service. DataServiceResponse response = context.SaveChanges(); @@ -816,7 +816,7 @@ public static void AddOrderDetailToOrderAuto() if (addedItem != null) { - Console.WriteLine("New {0} item added to order {1}.", + Console.WriteLine("New {0} item added to order {1}.", addedItem.Product.ProductName, addedItem.OrderID.ToString()); } } @@ -829,7 +829,7 @@ public static void AddOrderDetailToOrderAuto() "An error occurred when saving changes.", ex); } - // Handle any errors that may occur during insert, such as + // Handle any errors that may occur during insert, such as // a constraint violation. catch (DataServiceRequestException ex) { @@ -849,15 +849,15 @@ public static void CountAllCustomersValueOnly() // // Create the DataServiceContext using the service URI. NorthwindEntities context = new NorthwindEntities(svcUri); - + // Define a new query for Customers. DataServiceQuery query = context.Customers; - + try - { + { // Execute the query to just return the value of all customers in the set. int totalCount = query.Count(); - + // Retrieve the total count from the response. Console.WriteLine("There are {0} customers in total.", totalCount); } @@ -873,19 +873,19 @@ public static void CountAllCustomers() // // Create the DataServiceContext using the service URI. NorthwindEntities context = new NorthwindEntities(svcUri); - - // + + // // Define a new query for Customers that includes the total count. DataServiceQuery query = context.Customers.IncludeTotalCount(); // try - { - // + { + // // Execute the query for all customers and get the response object. - QueryOperationResponse response = + QueryOperationResponse response = query.Execute() as QueryOperationResponse; - // + // // Retrieve the total count from the response. Console.WriteLine("There are a total of {0} customers.", response.TotalCount); @@ -909,16 +909,16 @@ public static void GetCustomersPaged() // Create the DataServiceContext using the service URI. NorthwindEntities context = new NorthwindEntities(svcUri); DataServiceQueryContinuation token = null; - int pageCount = 0; + int pageCount = 0; try - { + { // Execute the query for all customers and get the response object. QueryOperationResponse response = context.Customers.Execute() as QueryOperationResponse; // - // With a paged response from the service, use a do...while loop + // With a paged response from the service, use a do...while loop // to enumerate the results before getting the next link. do { @@ -968,7 +968,7 @@ public static void GetCustomersPagedNested() context.Customers.AddQueryOption("$expand", "Orders") .Execute() as QueryOperationResponse; - // With a paged response from the service, use a do...while loop + // With a paged response from the service, use a do...while loop // to enumerate the results before getting the next link. do { @@ -989,7 +989,7 @@ public static void GetCustomersPagedNested() Console.WriteLine("\tCustomer Name: {0}", c.CompanyName); Console.WriteLine("\tOrders Page {0}:", ++innerPageCount); // Get the next link for the collection of related Orders. - DataServiceQueryContinuation nextOrdersLink = + DataServiceQueryContinuation nextOrdersLink = response.GetContinuation(c.Orders); // @@ -1026,18 +1026,18 @@ public static void SelectCustomerAddress() // Create the DataServiceContext using the service URI. NorthwindEntities context = new NorthwindEntities(svcUri); - // - // Define an anonymous LINQ query that projects the Customers type into + // + // Define an anonymous LINQ query that projects the Customers type into // a CustomerAddress type that contains only address properties. - // + // var query = from c in context.Customers where c.Country == "Germany" - select new CustomerAddress { - CustomerID = c.CustomerID, - Address = c.Address, - City = c.City, + select new CustomerAddress { + CustomerID = c.CustomerID, + Address = c.Address, + City = c.City, Region = c.Region, - PostalCode = c.PostalCode, + PostalCode = c.PostalCode, Country = c.Country}; // // @@ -1053,8 +1053,8 @@ public static void SelectCustomerAddress() // Write out the current values. Console.WriteLine("Customer ID: {0} \r\nStreet: {1} " - + "\r\nCity: {2} \r\nState: {3} \r\nZip Code: {4} \r\nCountry: {5}", - item.CustomerID, item.Address, item.City, item.Region, + + "\r\nCity: {2} \r\nState: {3} \r\nZip Code: {4} \r\nCountry: {5}", + item.CustomerID, item.Address, item.City, item.Region, item.PostalCode, item.Country); } @@ -1074,17 +1074,17 @@ public static void SelectCustomerAddressNonEntity() // Create the DataServiceContext using the service URI. NorthwindEntities context = new NorthwindEntities(svcUri); - // Define an anonymous LINQ query that projects the Customers type into + // Define an anonymous LINQ query that projects the Customers type into // a CustomerAddress type that contains only address properties. var query = from c in context.Customers where c.Country == "Germany" select new CustomerAddressNonEntity { - CompanyName = c.CompanyName, + CompanyName = c.CompanyName, Address = c.Address, - City = c.City, + City = c.City, Region = c.Region, - PostalCode = c.PostalCode, + PostalCode = c.PostalCode, Country = c.Country }; @@ -1099,7 +1099,7 @@ public static void SelectCustomerAddressNonEntity() + "\nCity: {2} \nState: {3} \nZip Code: {4} \nCountry: {5}", item.CompanyName, item.Address, item.City, item.Region, item.PostalCode, item.Country); - } + } } catch (DataServiceQueryException ex) { @@ -1113,17 +1113,17 @@ public static void ProjectWithConstructor() // Create the DataServiceContext using the service URI. NorthwindEntities context = new NorthwindEntities(svcUri); - // Define an anonymous LINQ query that projects the Customers type into + // Define an anonymous LINQ query that projects the Customers type into // a CustomerAddress type that contains only address properties. - // + // var query = from c in context.Customers where c.Country == "Germany" select new CustomerAddress( - c.CustomerID, - c.Address, - c.City, + c.CustomerID, + c.Address, + c.City, c.Region, - c.PostalCode, + c.PostalCode, c.Country); // @@ -1150,15 +1150,15 @@ public static void ProjectWithTransform() // Create the DataServiceContext using the service URI. NorthwindEntities context = new NorthwindEntities(svcUri); - // Define an anonymous LINQ query that projects the Customers type into + // Define an anonymous LINQ query that projects the Customers type into // a CustomerAddress type and tries to create a new Address string by // concatenating other properties. - // + // var query = from c in context.Customers where c.Country == "Germany" select new CustomerAddress { - CustomerID = c.CustomerID, + CustomerID = c.CustomerID, Address = "Full address:" + c.Address + ", " + c.City + ", " + c.Region + " " + c.PostalCode, City = c.City, @@ -1191,9 +1191,9 @@ public static void ProjectWithConvertion() // Create the DataServiceContext using the service URI. NorthwindEntities context = new NorthwindEntities(svcUri); - // Define an anonymous LINQ query that projects the Customers type into + // Define an anonymous LINQ query that projects the Customers type into // a CustomerAddress type that contains only address properties. - // + // var query = from c in context.Customers where c.Country == "Germany" select new CustomerAddress @@ -1235,7 +1235,7 @@ public static void LinqQueryPrecedence() // var ordersQuery = (from o in context.Orders where o.ShippedDate < DateTime.Today - orderby o.OrderDate descending, o.CustomerID + orderby o.OrderDate descending, o.CustomerID select o).Skip(10).Take(10); // @@ -1405,7 +1405,7 @@ public static void LinqOrderByClause() // Define a query for orders with a Freight value greater than 30. // var sortedCustomers = from c in context.Customers - orderby c.CompanyName ascending, + orderby c.CompanyName ascending, c.PostalCode descending select c; // @@ -1497,7 +1497,7 @@ public static void LinqSkipTakeMethod() // Create the DataServiceContext using the service URI. NorthwindEntities context = new NorthwindEntities(svcUri); - // Define a query that returns 25 orders after skipping the + // Define a query that returns 25 orders after skipping the // first 50 orders returned by the query. // var pagedOrders = (from o in context.Orders @@ -1530,7 +1530,7 @@ public static void ExplicitQuerySkipTakeMethod() // Create the DataServiceContext using the service URI. NorthwindEntities context = new NorthwindEntities(svcUri); - // Define a query that returns 25 orders after skipping the + // Define a query that returns 25 orders after skipping the // first 50 orders returned by the query. // var pagedOrders = context.Orders @@ -1608,12 +1608,12 @@ public static void LinqSelectMethod() var projectedQuery = context.Customers.Where(c => c.Country == "Germany") .Select(c => new CustomerAddress { - CustomerID = c.CustomerID, + CustomerID = c.CustomerID, Address = c.Address, City = c.City, Region = c.Region, PostalCode = c.PostalCode, - Country = c.Country}); + Country = c.Country}); // try @@ -1715,7 +1715,7 @@ public static void LinqQueryExpandMethod() } // } - #endregion + #endregion public static void LinqQueryClientEval() { // @@ -1726,7 +1726,7 @@ public static void LinqQueryClientEval() int basePrice = 100; decimal discount = .10M; - // Define a query that returns products based on a + // Define a query that returns products based on a // calculation that is determined on the client. var productsQuery = from p in context.Products where p.UnitPrice > @@ -1763,8 +1763,8 @@ public static void RegisterHeadersQuery() // Register to handle the SendingRequest event. // Note: If this must be done for every request to the data service, consider - // registering for this event by overriding the OnContextCreated partial method in - // the entity container, in this case NorthwindEntities. + // registering for this event by overriding the OnContextCreated partial method in + // the entity container, in this case NorthwindEntities. context.SendingRequest += new EventHandler(OnSendingRequest); // Define a query for orders with a Freight value greater than 30. @@ -1802,9 +1802,9 @@ private static void OnSendingRequest(object sender, SendingRequestEventArgs e) // // Create the DataServiceContext using the service URI. // NorthwindEntities context = new NorthwindEntities(svcUri); - // // Define an anonymous LINQ query that projects the Products type, + // // Define an anonymous LINQ query that projects the Products type, // // checking for relationships that return a null reference. - // // + // // // var query = from p in context.Products // where (p.Discontinued == false && p.ProductID > 77) // select new Product @@ -1829,7 +1829,7 @@ private static void OnSendingRequest(object sender, SendingRequestEventArgs e) // // Enumerate over the query result, which is executed implicitly. // foreach (var item in query) // { - + // // Write out the current values. // Console.WriteLine("Product ID: {0}/nUnits on order: {1}", // item.ProductID, item.UnitsOnOrder); @@ -1852,7 +1852,7 @@ public static void CallServiceOperationIQueryable() // Define the service operation query parameter. string city = "London"; - // Define the query URI to access the service operation with specific + // Define the query URI to access the service operation with specific // query options relative to the service URI. string queryString = string.Format("GetOrdersByCity?city='{0}'", city) + "&$orderby=ShippedDate desc" @@ -1897,7 +1897,7 @@ public static void CallServiceOperationCreateQuery() NorthwindEntities context = new NorthwindEntities(svcUri2); // Use the CreateQuery method to create a query that accessess - // the service operation passing a single parameter. + // the service operation passing a single parameter. var query = context.CreateQuery("GetOrdersByCity") .AddQueryOption("city", string.Format("'{0}'", city)) .Expand("Order_Details"); @@ -1928,7 +1928,7 @@ public static void CallServiceOperationCreateQuery() public static void CallServiceOperationSingleEntity() { // - // Define the query URI to access the service operation, + // Define the query URI to access the service operation, // relative to the service URI. string queryString = "GetNewestOrder"; @@ -1958,7 +1958,7 @@ Order order public static void CallServiceOperationEnumString() { // - // Define the query URI to access the service operation, + // Define the query URI to access the service operation, // relative to the service URI. string queryString = "GetCustomerNames"; @@ -1970,7 +1970,7 @@ public static void CallServiceOperationEnumString() // Execute a service operation that returns only the newest single order. IEnumerable customerNames = context.Execute(new Uri(queryString, UriKind.Relative)); - + foreach (string name in customerNames) { // Write out order information. @@ -1989,7 +1989,7 @@ IEnumerable customerNames public static void CallServiceOperationSingleInt() { // - // Define the query URI to access the service operation, + // Define the query URI to access the service operation, // relative to the service URI. string queryString = "CountOpenOrders"; @@ -1998,7 +1998,7 @@ public static void CallServiceOperationSingleInt() try { - // Execute a service operation that returns the integer + // Execute a service operation that returns the integer // count of open orders. int numOrders = (context.Execute(new Uri(queryString, UriKind.Relative))) @@ -2020,7 +2020,7 @@ int numOrders public static void CallServiceOperationVoid() { // - // Define the query URI to access the service operation, + // Define the query URI to access the service operation, // relative to the service URI. string queryString = "ReturnsNoData"; @@ -2051,14 +2051,14 @@ public static void CallServiceOperationQueryAsync() NorthwindEntities context = new NorthwindEntities(svcUri2); // Use the CreateQuery method to create a query that accessess - // the service operation passing a single parameter. + // the service operation passing a single parameter. var query = context.CreateQuery("GetOrdersByCity") .AddQueryOption("city", string.Format("'{0}'", city)) .Expand("Order_Details"); - // Execute the service operation that returns + // Execute the service operation that returns // all orders for the specified city. - var results = + var results = query.BeginExecute(OnAsyncQueryExecutionComplete, query); // } @@ -2068,7 +2068,7 @@ private static void OnAsyncQueryExecutionComplete(IAsyncResult result) { // Get the query back from the stored state. var query = result.AsyncState as DataServiceQuery; - + try { // Complete the exection and write out the results. @@ -2090,7 +2090,7 @@ private static void OnAsyncQueryExecutionComplete(IAsyncResult result) Console.WriteLine(response.Error.Message); } } - // + // public static void CallServiceOperationAsync() { @@ -2098,7 +2098,7 @@ public static void CallServiceOperationAsync() // Define the service operation query parameter. string city = "London"; - // Define the query URI to access the service operation with specific + // Define the query URI to access the service operation with specific // query options relative to the service URI. string queryString = string.Format("GetOrdersByCity?city='{0}'", city) + "&$orderby=ShippedDate desc" @@ -2107,20 +2107,20 @@ public static void CallServiceOperationAsync() // Create the DataServiceContext using the service URI. NorthwindEntities context = new NorthwindEntities(svcUri2); - // Execute the service operation that returns + // Execute the service operation that returns // all orders for the specified city. var results = context.BeginExecute( new Uri(queryString, UriKind.Relative), OnAsyncExecutionComplete, context); // } - + // private static void OnAsyncExecutionComplete(IAsyncResult result) { // Get the context back from the stored state. var context = result.AsyncState as NorthwindEntities; - + try { // Complete the exection and write out the results. diff --git a/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/astoriasnippetscs/customeraddressnonentitytest.cs b/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/astoriasnippetscs/customeraddressnonentitytest.cs index 74d4f76b5f65e..c0bc25d6adb9b 100644 --- a/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/astoriasnippetscs/customeraddressnonentitytest.cs +++ b/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/astoriasnippetscs/customeraddressnonentitytest.cs @@ -32,7 +32,7 @@ public TestContext TestContext } #region Additional test attributes - // + // //You can use the following additional attributes as you write your tests: // //Use ClassInitialize to run code before running the first test in the class diff --git a/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/astoriasnippetscs/customeraddresstest.cs b/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/astoriasnippetscs/customeraddresstest.cs index 26a50192090ca..de59f6885885f 100644 --- a/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/astoriasnippetscs/customeraddresstest.cs +++ b/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/astoriasnippetscs/customeraddresstest.cs @@ -32,7 +32,7 @@ public TestContext TestContext } #region Additional test attributes - // + // //You can use the following additional attributes as you write your tests: // //Use ClassInitialize to run code before running the first test in the class diff --git a/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/astoriasnippetscs/customerorders2test.cs b/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/astoriasnippetscs/customerorders2test.cs index d7fe2e5c9a2dd..4a4acb762e169 100644 --- a/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/astoriasnippetscs/customerorders2test.cs +++ b/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/astoriasnippetscs/customerorders2test.cs @@ -32,7 +32,7 @@ public TestContext TestContext } #region Additional test attributes - // + // //You can use the following additional attributes as you write your tests: // //Use ClassInitialize to run code before running the first test in the class diff --git a/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/astoriasnippetscs/customerordersasynctest.cs b/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/astoriasnippetscs/customerordersasynctest.cs index 9240867043287..99990174a1c9d 100644 --- a/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/astoriasnippetscs/customerordersasynctest.cs +++ b/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/astoriasnippetscs/customerordersasynctest.cs @@ -32,7 +32,7 @@ public TestContext TestContext } #region Additional test attributes - // + // //You can use the following additional attributes as you write your tests: // //Use ClassInitialize to run code before running the first test in the class diff --git a/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/astoriasnippetscs/customerorderscustomtest.cs b/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/astoriasnippetscs/customerorderscustomtest.cs index d5b885a827d7d..882915e9af7f1 100644 --- a/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/astoriasnippetscs/customerorderscustomtest.cs +++ b/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/astoriasnippetscs/customerorderscustomtest.cs @@ -32,7 +32,7 @@ public TestContext TestContext } #region Additional test attributes - // + // //You can use the following additional attributes as you write your tests: // //Use ClassInitialize to run code before running the first test in the class diff --git a/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/astoriasnippetscs/customerorderstest.cs b/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/astoriasnippetscs/customerorderstest.cs index 4a6194bc80d10..0a4d72d4cc793 100644 --- a/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/astoriasnippetscs/customerorderstest.cs +++ b/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/astoriasnippetscs/customerorderstest.cs @@ -32,7 +32,7 @@ public TestContext TestContext } #region Additional test attributes - // + // //You can use the following additional attributes as you write your tests: // //Use ClassInitialize to run code before running the first test in the class diff --git a/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/astoriasnippetscs/customerorderswpf2test.cs b/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/astoriasnippetscs/customerorderswpf2test.cs index 9a31b7279611d..791450e3bde18 100644 --- a/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/astoriasnippetscs/customerorderswpf2test.cs +++ b/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/astoriasnippetscs/customerorderswpf2test.cs @@ -32,7 +32,7 @@ public TestContext TestContext } #region Additional test attributes - // + // //You can use the following additional attributes as you write your tests: // //Use ClassInitialize to run code before running the first test in the class diff --git a/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/astoriasnippetscs/customerorderswpf3test.cs b/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/astoriasnippetscs/customerorderswpf3test.cs index c2f6543a661f4..70008c6f6bb0f 100644 --- a/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/astoriasnippetscs/customerorderswpf3test.cs +++ b/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/astoriasnippetscs/customerorderswpf3test.cs @@ -32,7 +32,7 @@ public TestContext TestContext } #region Additional test attributes - // + // //You can use the following additional attributes as you write your tests: // //Use ClassInitialize to run code before running the first test in the class diff --git a/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/astoriasnippetscs/customerorderswpftest.cs b/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/astoriasnippetscs/customerorderswpftest.cs index df0947c6842b8..be9cbc760efb8 100644 --- a/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/astoriasnippetscs/customerorderswpftest.cs +++ b/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/astoriasnippetscs/customerorderswpftest.cs @@ -32,7 +32,7 @@ public TestContext TestContext } #region Additional test attributes - // + // //You can use the following additional attributes as you write your tests: // //Use ClassInitialize to run code before running the first test in the class diff --git a/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/astoriasnippetscs/salesorderstest.cs b/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/astoriasnippetscs/salesorderstest.cs index 16bda8ac5fe14..e84e380a01056 100644 --- a/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/astoriasnippetscs/salesorderstest.cs +++ b/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/astoriasnippetscs/salesorderstest.cs @@ -32,7 +32,7 @@ public TestContext TestContext } #region Additional test attributes - // + // //You can use the following additional attributes as you write your tests: // //Use ClassInitialize to run code before running the first test in the class diff --git a/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/astoriasnippetscs/sourcetest.cs b/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/astoriasnippetscs/sourcetest.cs index 67b9f82e1610d..d9e86a1fc22e3 100644 --- a/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/astoriasnippetscs/sourcetest.cs +++ b/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/astoriasnippetscs/sourcetest.cs @@ -32,7 +32,7 @@ public TestContext TestContext } #region Additional test attributes - // + // //You can use the following additional attributes as you write your tests: // //Use ClassInitialize to run code before running the first test in the class diff --git a/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/cs/default.aspx.designer.cs b/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/cs/default.aspx.designer.cs index 8874bc9c4c337..6ad6a425b7651 100644 --- a/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/cs/default.aspx.designer.cs +++ b/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/cs/default.aspx.designer.cs @@ -9,10 +9,10 @@ //------------------------------------------------------------------------------ namespace NorthwindDataService { - - + + public partial class _Default { - + /// /// form1 control. /// diff --git a/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/cs/northwind.designer.cs b/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/cs/northwind.designer.cs index bd6f1375d1c0f..783f2bdaa84f4 100644 --- a/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/cs/northwind.designer.cs +++ b/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/cs/northwind.designer.cs @@ -35,14 +35,14 @@ namespace NorthwindDataService { #region Contexts - + /// /// No Metadata Documentation available. /// public partial class NorthwindEntities : ObjectContext { #region Constructors - + /// /// Initializes a new NorthwindEntities object using the connection string found in the 'NorthwindEntities' section of the application configuration file. /// @@ -51,7 +51,7 @@ public NorthwindEntities() : base("name=NorthwindEntities", "NorthwindEntities") this.ContextOptions.LazyLoadingEnabled = true; OnContextCreated(); } - + /// /// Initialize a new NorthwindEntities object. /// @@ -60,7 +60,7 @@ public NorthwindEntities(string connectionString) : base(connectionString, "Nort this.ContextOptions.LazyLoadingEnabled = true; OnContextCreated(); } - + /// /// Initialize a new NorthwindEntities object. /// @@ -69,17 +69,17 @@ public NorthwindEntities(EntityConnection connection) : base(connection, "Northw this.ContextOptions.LazyLoadingEnabled = true; OnContextCreated(); } - + #endregion - + #region Partial Methods - + partial void OnContextCreated(); - + #endregion - + #region ObjectSet Properties - + /// /// No Metadata Documentation available. /// @@ -95,7 +95,7 @@ public ObjectSet Categories } } private ObjectSet _Categories; - + /// /// No Metadata Documentation available. /// @@ -111,7 +111,7 @@ public ObjectSet CustomerDemographics } } private ObjectSet _CustomerDemographics; - + /// /// No Metadata Documentation available. /// @@ -127,7 +127,7 @@ public ObjectSet Customers } } private ObjectSet _Customers; - + /// /// No Metadata Documentation available. /// @@ -143,7 +143,7 @@ public ObjectSet Employees } } private ObjectSet _Employees; - + /// /// No Metadata Documentation available. /// @@ -159,7 +159,7 @@ public ObjectSet Order_Details } } private ObjectSet _Order_Details; - + /// /// No Metadata Documentation available. /// @@ -175,7 +175,7 @@ public ObjectSet Orders } } private ObjectSet _Orders; - + /// /// No Metadata Documentation available. /// @@ -191,7 +191,7 @@ public ObjectSet Products } } private ObjectSet _Products; - + /// /// No Metadata Documentation available. /// @@ -207,7 +207,7 @@ public ObjectSet Regions } } private ObjectSet _Regions; - + /// /// No Metadata Documentation available. /// @@ -223,7 +223,7 @@ public ObjectSet Suppliers } } private ObjectSet _Suppliers; - + /// /// No Metadata Documentation available. /// @@ -239,7 +239,7 @@ public ObjectSet Shippers } } private ObjectSet _Shippers; - + /// /// No Metadata Documentation available. /// @@ -258,7 +258,7 @@ public ObjectSet Territories #endregion #region AddTo Methods - + /// /// Deprecated Method for adding a new object to the Categories EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// @@ -266,7 +266,7 @@ public void AddToCategories(Category category) { base.AddObject("Categories", category); } - + /// /// Deprecated Method for adding a new object to the CustomerDemographics EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// @@ -274,7 +274,7 @@ public void AddToCustomerDemographics(CustomerDemographic customerDemographic) { base.AddObject("CustomerDemographics", customerDemographic); } - + /// /// Deprecated Method for adding a new object to the Customers EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// @@ -282,7 +282,7 @@ public void AddToCustomers(Customer customer) { base.AddObject("Customers", customer); } - + /// /// Deprecated Method for adding a new object to the Employees EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// @@ -290,7 +290,7 @@ public void AddToEmployees(Employee employee) { base.AddObject("Employees", employee); } - + /// /// Deprecated Method for adding a new object to the Order_Details EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// @@ -298,7 +298,7 @@ public void AddToOrder_Details(Order_Detail order_Detail) { base.AddObject("Order_Details", order_Detail); } - + /// /// Deprecated Method for adding a new object to the Orders EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// @@ -306,7 +306,7 @@ public void AddToOrders(Order order) { base.AddObject("Orders", order); } - + /// /// Deprecated Method for adding a new object to the Products EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// @@ -314,7 +314,7 @@ public void AddToProducts(Product product) { base.AddObject("Products", product); } - + /// /// Deprecated Method for adding a new object to the Regions EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// @@ -322,7 +322,7 @@ public void AddToRegions(Region region) { base.AddObject("Regions", region); } - + /// /// Deprecated Method for adding a new object to the Suppliers EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// @@ -330,7 +330,7 @@ public void AddToSuppliers(Supplier supplier) { base.AddObject("Suppliers", supplier); } - + /// /// Deprecated Method for adding a new object to the Shippers EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// @@ -338,7 +338,7 @@ public void AddToShippers(Shipper shipper) { base.AddObject("Shippers", shipper); } - + /// /// Deprecated Method for adding a new object to the Territories EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// @@ -349,12 +349,12 @@ public void AddToTerritories(Territory territory) #endregion } - + #endregion - + #region Entities - + /// /// No Metadata Documentation available. /// @@ -364,7 +364,7 @@ public void AddToTerritories(Territory territory) public partial class Category : EntityObject { #region Factory Method - + /// /// Create a new Category object. /// @@ -380,7 +380,7 @@ public static Category CreateCategory(global::System.Int32 categoryID, global::S #endregion #region Primitive Properties - + /// /// No Metadata Documentation available. /// @@ -407,7 +407,7 @@ public static Category CreateCategory(global::System.Int32 categoryID, global::S private global::System.Int32 _CategoryID; partial void OnCategoryIDChanging(global::System.Int32 value); partial void OnCategoryIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -431,7 +431,7 @@ public static Category CreateCategory(global::System.Int32 categoryID, global::S private global::System.String _CategoryName; partial void OnCategoryNameChanging(global::System.String value); partial void OnCategoryNameChanged(); - + /// /// No Metadata Documentation available. /// @@ -455,7 +455,7 @@ public static Category CreateCategory(global::System.Int32 categoryID, global::S private global::System.String _Description; partial void OnDescriptionChanging(global::System.String value); partial void OnDescriptionChanged(); - + /// /// No Metadata Documentation available. /// @@ -481,9 +481,9 @@ public static Category CreateCategory(global::System.Int32 categoryID, global::S partial void OnPictureChanged(); #endregion - + #region Navigation Properties - + /// /// No Metadata Documentation available. /// @@ -508,7 +508,7 @@ public EntityCollection Products #endregion } - + /// /// No Metadata Documentation available. /// @@ -518,7 +518,7 @@ public EntityCollection Products public partial class Customer : EntityObject { #region Factory Method - + /// /// Create a new Customer object. /// @@ -534,7 +534,7 @@ public static Customer CreateCustomer(global::System.String customerID, global:: #endregion #region Primitive Properties - + /// /// No Metadata Documentation available. /// @@ -561,7 +561,7 @@ public static Customer CreateCustomer(global::System.String customerID, global:: private global::System.String _CustomerID; partial void OnCustomerIDChanging(global::System.String value); partial void OnCustomerIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -585,7 +585,7 @@ public static Customer CreateCustomer(global::System.String customerID, global:: private global::System.String _CompanyName; partial void OnCompanyNameChanging(global::System.String value); partial void OnCompanyNameChanged(); - + /// /// No Metadata Documentation available. /// @@ -609,7 +609,7 @@ public static Customer CreateCustomer(global::System.String customerID, global:: private global::System.String _ContactName; partial void OnContactNameChanging(global::System.String value); partial void OnContactNameChanged(); - + /// /// No Metadata Documentation available. /// @@ -633,7 +633,7 @@ public static Customer CreateCustomer(global::System.String customerID, global:: private global::System.String _ContactTitle; partial void OnContactTitleChanging(global::System.String value); partial void OnContactTitleChanged(); - + /// /// No Metadata Documentation available. /// @@ -657,7 +657,7 @@ public static Customer CreateCustomer(global::System.String customerID, global:: private global::System.String _Address; partial void OnAddressChanging(global::System.String value); partial void OnAddressChanged(); - + /// /// No Metadata Documentation available. /// @@ -681,7 +681,7 @@ public static Customer CreateCustomer(global::System.String customerID, global:: private global::System.String _City; partial void OnCityChanging(global::System.String value); partial void OnCityChanged(); - + /// /// No Metadata Documentation available. /// @@ -705,7 +705,7 @@ public static Customer CreateCustomer(global::System.String customerID, global:: private global::System.String _Region; partial void OnRegionChanging(global::System.String value); partial void OnRegionChanged(); - + /// /// No Metadata Documentation available. /// @@ -729,7 +729,7 @@ public static Customer CreateCustomer(global::System.String customerID, global:: private global::System.String _PostalCode; partial void OnPostalCodeChanging(global::System.String value); partial void OnPostalCodeChanged(); - + /// /// No Metadata Documentation available. /// @@ -753,7 +753,7 @@ public static Customer CreateCustomer(global::System.String customerID, global:: private global::System.String _Country; partial void OnCountryChanging(global::System.String value); partial void OnCountryChanged(); - + /// /// No Metadata Documentation available. /// @@ -777,7 +777,7 @@ public static Customer CreateCustomer(global::System.String customerID, global:: private global::System.String _Phone; partial void OnPhoneChanging(global::System.String value); partial void OnPhoneChanged(); - + /// /// No Metadata Documentation available. /// @@ -803,9 +803,9 @@ public static Customer CreateCustomer(global::System.String customerID, global:: partial void OnFaxChanged(); #endregion - + #region Navigation Properties - + /// /// No Metadata Documentation available. /// @@ -827,7 +827,7 @@ public EntityCollection Orders } } } - + /// /// No Metadata Documentation available. /// @@ -852,7 +852,7 @@ public EntityCollection CustomerDemographics #endregion } - + /// /// No Metadata Documentation available. /// @@ -862,7 +862,7 @@ public EntityCollection CustomerDemographics public partial class CustomerDemographic : EntityObject { #region Factory Method - + /// /// Create a new CustomerDemographic object. /// @@ -876,7 +876,7 @@ public static CustomerDemographic CreateCustomerDemographic(global::System.Strin #endregion #region Primitive Properties - + /// /// No Metadata Documentation available. /// @@ -903,7 +903,7 @@ public static CustomerDemographic CreateCustomerDemographic(global::System.Strin private global::System.String _CustomerTypeID; partial void OnCustomerTypeIDChanging(global::System.String value); partial void OnCustomerTypeIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -929,9 +929,9 @@ public static CustomerDemographic CreateCustomerDemographic(global::System.Strin partial void OnCustomerDescChanged(); #endregion - + #region Navigation Properties - + /// /// No Metadata Documentation available. /// @@ -956,7 +956,7 @@ public EntityCollection Customers #endregion } - + /// /// No Metadata Documentation available. /// @@ -966,7 +966,7 @@ public EntityCollection Customers public partial class Employee : EntityObject { #region Factory Method - + /// /// Create a new Employee object. /// @@ -984,7 +984,7 @@ public static Employee CreateEmployee(global::System.Int32 employeeID, global::S #endregion #region Primitive Properties - + /// /// No Metadata Documentation available. /// @@ -1011,7 +1011,7 @@ public static Employee CreateEmployee(global::System.Int32 employeeID, global::S private global::System.Int32 _EmployeeID; partial void OnEmployeeIDChanging(global::System.Int32 value); partial void OnEmployeeIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1035,7 +1035,7 @@ public static Employee CreateEmployee(global::System.Int32 employeeID, global::S private global::System.String _LastName; partial void OnLastNameChanging(global::System.String value); partial void OnLastNameChanged(); - + /// /// No Metadata Documentation available. /// @@ -1059,7 +1059,7 @@ public static Employee CreateEmployee(global::System.Int32 employeeID, global::S private global::System.String _FirstName; partial void OnFirstNameChanging(global::System.String value); partial void OnFirstNameChanged(); - + /// /// No Metadata Documentation available. /// @@ -1083,7 +1083,7 @@ public static Employee CreateEmployee(global::System.Int32 employeeID, global::S private global::System.String _Title; partial void OnTitleChanging(global::System.String value); partial void OnTitleChanged(); - + /// /// No Metadata Documentation available. /// @@ -1107,7 +1107,7 @@ public static Employee CreateEmployee(global::System.Int32 employeeID, global::S private global::System.String _TitleOfCourtesy; partial void OnTitleOfCourtesyChanging(global::System.String value); partial void OnTitleOfCourtesyChanged(); - + /// /// No Metadata Documentation available. /// @@ -1131,7 +1131,7 @@ public static Employee CreateEmployee(global::System.Int32 employeeID, global::S private Nullable _BirthDate; partial void OnBirthDateChanging(Nullable value); partial void OnBirthDateChanged(); - + /// /// No Metadata Documentation available. /// @@ -1155,7 +1155,7 @@ public static Employee CreateEmployee(global::System.Int32 employeeID, global::S private Nullable _HireDate; partial void OnHireDateChanging(Nullable value); partial void OnHireDateChanged(); - + /// /// No Metadata Documentation available. /// @@ -1179,7 +1179,7 @@ public static Employee CreateEmployee(global::System.Int32 employeeID, global::S private global::System.String _Address; partial void OnAddressChanging(global::System.String value); partial void OnAddressChanged(); - + /// /// No Metadata Documentation available. /// @@ -1203,7 +1203,7 @@ public static Employee CreateEmployee(global::System.Int32 employeeID, global::S private global::System.String _City; partial void OnCityChanging(global::System.String value); partial void OnCityChanged(); - + /// /// No Metadata Documentation available. /// @@ -1227,7 +1227,7 @@ public static Employee CreateEmployee(global::System.Int32 employeeID, global::S private global::System.String _Region; partial void OnRegionChanging(global::System.String value); partial void OnRegionChanged(); - + /// /// No Metadata Documentation available. /// @@ -1251,7 +1251,7 @@ public static Employee CreateEmployee(global::System.Int32 employeeID, global::S private global::System.String _PostalCode; partial void OnPostalCodeChanging(global::System.String value); partial void OnPostalCodeChanged(); - + /// /// No Metadata Documentation available. /// @@ -1275,7 +1275,7 @@ public static Employee CreateEmployee(global::System.Int32 employeeID, global::S private global::System.String _Country; partial void OnCountryChanging(global::System.String value); partial void OnCountryChanged(); - + /// /// No Metadata Documentation available. /// @@ -1299,7 +1299,7 @@ public static Employee CreateEmployee(global::System.Int32 employeeID, global::S private global::System.String _HomePhone; partial void OnHomePhoneChanging(global::System.String value); partial void OnHomePhoneChanged(); - + /// /// No Metadata Documentation available. /// @@ -1323,7 +1323,7 @@ public static Employee CreateEmployee(global::System.Int32 employeeID, global::S private global::System.String _Extension; partial void OnExtensionChanging(global::System.String value); partial void OnExtensionChanged(); - + /// /// No Metadata Documentation available. /// @@ -1347,7 +1347,7 @@ public static Employee CreateEmployee(global::System.Int32 employeeID, global::S private global::System.Byte[] _Photo; partial void OnPhotoChanging(global::System.Byte[] value); partial void OnPhotoChanged(); - + /// /// No Metadata Documentation available. /// @@ -1371,7 +1371,7 @@ public static Employee CreateEmployee(global::System.Int32 employeeID, global::S private global::System.String _Notes; partial void OnNotesChanging(global::System.String value); partial void OnNotesChanged(); - + /// /// No Metadata Documentation available. /// @@ -1395,7 +1395,7 @@ public static Employee CreateEmployee(global::System.Int32 employeeID, global::S private Nullable _ReportsTo; partial void OnReportsToChanging(Nullable value); partial void OnReportsToChanged(); - + /// /// No Metadata Documentation available. /// @@ -1421,9 +1421,9 @@ public static Employee CreateEmployee(global::System.Int32 employeeID, global::S partial void OnPhotoPathChanged(); #endregion - + #region Navigation Properties - + /// /// No Metadata Documentation available. /// @@ -1445,7 +1445,7 @@ public EntityCollection Employees1 } } } - + /// /// No Metadata Documentation available. /// @@ -1483,7 +1483,7 @@ public EntityReference Employee1Reference } } } - + /// /// No Metadata Documentation available. /// @@ -1505,7 +1505,7 @@ public EntityCollection Orders } } } - + /// /// No Metadata Documentation available. /// @@ -1530,7 +1530,7 @@ public EntityCollection Territories #endregion } - + /// /// No Metadata Documentation available. /// @@ -1540,7 +1540,7 @@ public EntityCollection Territories public partial class Order : EntityObject { #region Factory Method - + /// /// Create a new Order object. /// @@ -1554,7 +1554,7 @@ public static Order CreateOrder(global::System.Int32 orderID) #endregion #region Primitive Properties - + /// /// No Metadata Documentation available. /// @@ -1581,7 +1581,7 @@ public static Order CreateOrder(global::System.Int32 orderID) private global::System.Int32 _OrderID; partial void OnOrderIDChanging(global::System.Int32 value); partial void OnOrderIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1605,7 +1605,7 @@ public static Order CreateOrder(global::System.Int32 orderID) private global::System.String _CustomerID; partial void OnCustomerIDChanging(global::System.String value); partial void OnCustomerIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1629,7 +1629,7 @@ public static Order CreateOrder(global::System.Int32 orderID) private Nullable _EmployeeID; partial void OnEmployeeIDChanging(Nullable value); partial void OnEmployeeIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -1653,7 +1653,7 @@ public static Order CreateOrder(global::System.Int32 orderID) private Nullable _OrderDate; partial void OnOrderDateChanging(Nullable value); partial void OnOrderDateChanged(); - + /// /// No Metadata Documentation available. /// @@ -1677,7 +1677,7 @@ public static Order CreateOrder(global::System.Int32 orderID) private Nullable _RequiredDate; partial void OnRequiredDateChanging(Nullable value); partial void OnRequiredDateChanged(); - + /// /// No Metadata Documentation available. /// @@ -1701,7 +1701,7 @@ public static Order CreateOrder(global::System.Int32 orderID) private Nullable _ShippedDate; partial void OnShippedDateChanging(Nullable value); partial void OnShippedDateChanged(); - + /// /// No Metadata Documentation available. /// @@ -1725,7 +1725,7 @@ public static Order CreateOrder(global::System.Int32 orderID) private Nullable _ShipVia; partial void OnShipViaChanging(Nullable value); partial void OnShipViaChanged(); - + /// /// No Metadata Documentation available. /// @@ -1749,7 +1749,7 @@ public static Order CreateOrder(global::System.Int32 orderID) private Nullable _Freight; partial void OnFreightChanging(Nullable value); partial void OnFreightChanged(); - + /// /// No Metadata Documentation available. /// @@ -1773,7 +1773,7 @@ public static Order CreateOrder(global::System.Int32 orderID) private global::System.String _ShipName; partial void OnShipNameChanging(global::System.String value); partial void OnShipNameChanged(); - + /// /// No Metadata Documentation available. /// @@ -1797,7 +1797,7 @@ public static Order CreateOrder(global::System.Int32 orderID) private global::System.String _ShipAddress; partial void OnShipAddressChanging(global::System.String value); partial void OnShipAddressChanged(); - + /// /// No Metadata Documentation available. /// @@ -1821,7 +1821,7 @@ public static Order CreateOrder(global::System.Int32 orderID) private global::System.String _ShipCity; partial void OnShipCityChanging(global::System.String value); partial void OnShipCityChanged(); - + /// /// No Metadata Documentation available. /// @@ -1845,7 +1845,7 @@ public static Order CreateOrder(global::System.Int32 orderID) private global::System.String _ShipRegion; partial void OnShipRegionChanging(global::System.String value); partial void OnShipRegionChanged(); - + /// /// No Metadata Documentation available. /// @@ -1869,7 +1869,7 @@ public static Order CreateOrder(global::System.Int32 orderID) private global::System.String _ShipPostalCode; partial void OnShipPostalCodeChanging(global::System.String value); partial void OnShipPostalCodeChanged(); - + /// /// No Metadata Documentation available. /// @@ -1895,9 +1895,9 @@ public static Order CreateOrder(global::System.Int32 orderID) partial void OnShipCountryChanged(); #endregion - + #region Navigation Properties - + /// /// No Metadata Documentation available. /// @@ -1935,7 +1935,7 @@ public EntityReference CustomerReference } } } - + /// /// No Metadata Documentation available. /// @@ -1973,7 +1973,7 @@ public EntityReference EmployeeReference } } } - + /// /// No Metadata Documentation available. /// @@ -1995,7 +1995,7 @@ public EntityCollection Order_Details } } } - + /// /// No Metadata Documentation available. /// @@ -2036,7 +2036,7 @@ public EntityReference ShipperReference #endregion } - + /// /// No Metadata Documentation available. /// @@ -2046,7 +2046,7 @@ public EntityReference ShipperReference public partial class Order_Detail : EntityObject { #region Factory Method - + /// /// Create a new Order_Detail object. /// @@ -2068,7 +2068,7 @@ public static Order_Detail CreateOrder_Detail(global::System.Int32 orderID, glob #endregion #region Primitive Properties - + /// /// No Metadata Documentation available. /// @@ -2095,7 +2095,7 @@ public static Order_Detail CreateOrder_Detail(global::System.Int32 orderID, glob private global::System.Int32 _OrderID; partial void OnOrderIDChanging(global::System.Int32 value); partial void OnOrderIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2122,7 +2122,7 @@ public static Order_Detail CreateOrder_Detail(global::System.Int32 orderID, glob private global::System.Int32 _ProductID; partial void OnProductIDChanging(global::System.Int32 value); partial void OnProductIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2146,7 +2146,7 @@ public static Order_Detail CreateOrder_Detail(global::System.Int32 orderID, glob private global::System.Decimal _UnitPrice; partial void OnUnitPriceChanging(global::System.Decimal value); partial void OnUnitPriceChanged(); - + /// /// No Metadata Documentation available. /// @@ -2170,7 +2170,7 @@ public static Order_Detail CreateOrder_Detail(global::System.Int32 orderID, glob private global::System.Int16 _Quantity; partial void OnQuantityChanging(global::System.Int16 value); partial void OnQuantityChanged(); - + /// /// No Metadata Documentation available. /// @@ -2196,9 +2196,9 @@ public static Order_Detail CreateOrder_Detail(global::System.Int32 orderID, glob partial void OnDiscountChanged(); #endregion - + #region Navigation Properties - + /// /// No Metadata Documentation available. /// @@ -2236,7 +2236,7 @@ public EntityReference OrderReference } } } - + /// /// No Metadata Documentation available. /// @@ -2277,7 +2277,7 @@ public EntityReference ProductReference #endregion } - + /// /// No Metadata Documentation available. /// @@ -2287,7 +2287,7 @@ public EntityReference ProductReference public partial class Product : EntityObject { #region Factory Method - + /// /// Create a new Product object. /// @@ -2305,7 +2305,7 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst #endregion #region Primitive Properties - + /// /// No Metadata Documentation available. /// @@ -2332,7 +2332,7 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst private global::System.Int32 _ProductID; partial void OnProductIDChanging(global::System.Int32 value); partial void OnProductIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2356,7 +2356,7 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst private global::System.String _ProductName; partial void OnProductNameChanging(global::System.String value); partial void OnProductNameChanged(); - + /// /// No Metadata Documentation available. /// @@ -2380,7 +2380,7 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst private Nullable _SupplierID; partial void OnSupplierIDChanging(Nullable value); partial void OnSupplierIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2404,7 +2404,7 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst private Nullable _CategoryID; partial void OnCategoryIDChanging(Nullable value); partial void OnCategoryIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2428,7 +2428,7 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst private global::System.String _QuantityPerUnit; partial void OnQuantityPerUnitChanging(global::System.String value); partial void OnQuantityPerUnitChanged(); - + /// /// No Metadata Documentation available. /// @@ -2452,7 +2452,7 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst private Nullable _UnitPrice; partial void OnUnitPriceChanging(Nullable value); partial void OnUnitPriceChanged(); - + /// /// No Metadata Documentation available. /// @@ -2476,7 +2476,7 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst private Nullable _UnitsInStock; partial void OnUnitsInStockChanging(Nullable value); partial void OnUnitsInStockChanged(); - + /// /// No Metadata Documentation available. /// @@ -2500,7 +2500,7 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst private Nullable _UnitsOnOrder; partial void OnUnitsOnOrderChanging(Nullable value); partial void OnUnitsOnOrderChanged(); - + /// /// No Metadata Documentation available. /// @@ -2524,7 +2524,7 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst private Nullable _ReorderLevel; partial void OnReorderLevelChanging(Nullable value); partial void OnReorderLevelChanged(); - + /// /// No Metadata Documentation available. /// @@ -2550,9 +2550,9 @@ public static Product CreateProduct(global::System.Int32 productID, global::Syst partial void OnDiscontinuedChanged(); #endregion - + #region Navigation Properties - + /// /// No Metadata Documentation available. /// @@ -2590,7 +2590,7 @@ public EntityReference CategoryReference } } } - + /// /// No Metadata Documentation available. /// @@ -2612,7 +2612,7 @@ public EntityCollection Order_Details } } } - + /// /// No Metadata Documentation available. /// @@ -2653,7 +2653,7 @@ public EntityReference SupplierReference #endregion } - + /// /// No Metadata Documentation available. /// @@ -2663,7 +2663,7 @@ public EntityReference SupplierReference public partial class Region : EntityObject { #region Factory Method - + /// /// Create a new Region object. /// @@ -2679,7 +2679,7 @@ public static Region CreateRegion(global::System.Int32 regionID, global::System. #endregion #region Primitive Properties - + /// /// No Metadata Documentation available. /// @@ -2706,7 +2706,7 @@ public static Region CreateRegion(global::System.Int32 regionID, global::System. private global::System.Int32 _RegionID; partial void OnRegionIDChanging(global::System.Int32 value); partial void OnRegionIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2732,9 +2732,9 @@ public static Region CreateRegion(global::System.Int32 regionID, global::System. partial void OnRegionDescriptionChanged(); #endregion - + #region Navigation Properties - + /// /// No Metadata Documentation available. /// @@ -2759,7 +2759,7 @@ public EntityCollection Territories #endregion } - + /// /// No Metadata Documentation available. /// @@ -2769,7 +2769,7 @@ public EntityCollection Territories public partial class Shipper : EntityObject { #region Factory Method - + /// /// Create a new Shipper object. /// @@ -2785,7 +2785,7 @@ public static Shipper CreateShipper(global::System.Int32 shipperID, global::Syst #endregion #region Primitive Properties - + /// /// No Metadata Documentation available. /// @@ -2812,7 +2812,7 @@ public static Shipper CreateShipper(global::System.Int32 shipperID, global::Syst private global::System.Int32 _ShipperID; partial void OnShipperIDChanging(global::System.Int32 value); partial void OnShipperIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2836,7 +2836,7 @@ public static Shipper CreateShipper(global::System.Int32 shipperID, global::Syst private global::System.String _CompanyName; partial void OnCompanyNameChanging(global::System.String value); partial void OnCompanyNameChanged(); - + /// /// No Metadata Documentation available. /// @@ -2862,9 +2862,9 @@ public static Shipper CreateShipper(global::System.Int32 shipperID, global::Syst partial void OnPhoneChanged(); #endregion - + #region Navigation Properties - + /// /// No Metadata Documentation available. /// @@ -2889,7 +2889,7 @@ public EntityCollection Orders #endregion } - + /// /// No Metadata Documentation available. /// @@ -2899,7 +2899,7 @@ public EntityCollection Orders public partial class Supplier : EntityObject { #region Factory Method - + /// /// Create a new Supplier object. /// @@ -2915,7 +2915,7 @@ public static Supplier CreateSupplier(global::System.Int32 supplierID, global::S #endregion #region Primitive Properties - + /// /// No Metadata Documentation available. /// @@ -2942,7 +2942,7 @@ public static Supplier CreateSupplier(global::System.Int32 supplierID, global::S private global::System.Int32 _SupplierID; partial void OnSupplierIDChanging(global::System.Int32 value); partial void OnSupplierIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -2966,7 +2966,7 @@ public static Supplier CreateSupplier(global::System.Int32 supplierID, global::S private global::System.String _CompanyName; partial void OnCompanyNameChanging(global::System.String value); partial void OnCompanyNameChanged(); - + /// /// No Metadata Documentation available. /// @@ -2990,7 +2990,7 @@ public static Supplier CreateSupplier(global::System.Int32 supplierID, global::S private global::System.String _ContactName; partial void OnContactNameChanging(global::System.String value); partial void OnContactNameChanged(); - + /// /// No Metadata Documentation available. /// @@ -3014,7 +3014,7 @@ public static Supplier CreateSupplier(global::System.Int32 supplierID, global::S private global::System.String _ContactTitle; partial void OnContactTitleChanging(global::System.String value); partial void OnContactTitleChanged(); - + /// /// No Metadata Documentation available. /// @@ -3038,7 +3038,7 @@ public static Supplier CreateSupplier(global::System.Int32 supplierID, global::S private global::System.String _Address; partial void OnAddressChanging(global::System.String value); partial void OnAddressChanged(); - + /// /// No Metadata Documentation available. /// @@ -3062,7 +3062,7 @@ public static Supplier CreateSupplier(global::System.Int32 supplierID, global::S private global::System.String _City; partial void OnCityChanging(global::System.String value); partial void OnCityChanged(); - + /// /// No Metadata Documentation available. /// @@ -3086,7 +3086,7 @@ public static Supplier CreateSupplier(global::System.Int32 supplierID, global::S private global::System.String _Region; partial void OnRegionChanging(global::System.String value); partial void OnRegionChanged(); - + /// /// No Metadata Documentation available. /// @@ -3110,7 +3110,7 @@ public static Supplier CreateSupplier(global::System.Int32 supplierID, global::S private global::System.String _PostalCode; partial void OnPostalCodeChanging(global::System.String value); partial void OnPostalCodeChanged(); - + /// /// No Metadata Documentation available. /// @@ -3134,7 +3134,7 @@ public static Supplier CreateSupplier(global::System.Int32 supplierID, global::S private global::System.String _Country; partial void OnCountryChanging(global::System.String value); partial void OnCountryChanged(); - + /// /// No Metadata Documentation available. /// @@ -3158,7 +3158,7 @@ public static Supplier CreateSupplier(global::System.Int32 supplierID, global::S private global::System.String _Phone; partial void OnPhoneChanging(global::System.String value); partial void OnPhoneChanged(); - + /// /// No Metadata Documentation available. /// @@ -3182,7 +3182,7 @@ public static Supplier CreateSupplier(global::System.Int32 supplierID, global::S private global::System.String _Fax; partial void OnFaxChanging(global::System.String value); partial void OnFaxChanged(); - + /// /// No Metadata Documentation available. /// @@ -3208,9 +3208,9 @@ public static Supplier CreateSupplier(global::System.Int32 supplierID, global::S partial void OnHomePageChanged(); #endregion - + #region Navigation Properties - + /// /// No Metadata Documentation available. /// @@ -3235,7 +3235,7 @@ public EntityCollection Products #endregion } - + /// /// No Metadata Documentation available. /// @@ -3245,7 +3245,7 @@ public EntityCollection Products public partial class Territory : EntityObject { #region Factory Method - + /// /// Create a new Territory object. /// @@ -3263,7 +3263,7 @@ public static Territory CreateTerritory(global::System.String territoryID, globa #endregion #region Primitive Properties - + /// /// No Metadata Documentation available. /// @@ -3290,7 +3290,7 @@ public static Territory CreateTerritory(global::System.String territoryID, globa private global::System.String _TerritoryID; partial void OnTerritoryIDChanging(global::System.String value); partial void OnTerritoryIDChanged(); - + /// /// No Metadata Documentation available. /// @@ -3314,7 +3314,7 @@ public static Territory CreateTerritory(global::System.String territoryID, globa private global::System.String _TerritoryDescription; partial void OnTerritoryDescriptionChanging(global::System.String value); partial void OnTerritoryDescriptionChanged(); - + /// /// No Metadata Documentation available. /// @@ -3340,9 +3340,9 @@ public static Territory CreateTerritory(global::System.String territoryID, globa partial void OnRegionIDChanged(); #endregion - + #region Navigation Properties - + /// /// No Metadata Documentation available. /// @@ -3380,7 +3380,7 @@ public EntityReference RegionReference } } } - + /// /// No Metadata Documentation available. /// @@ -3407,5 +3407,5 @@ public EntityCollection Employees } #endregion - + } diff --git a/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/cs/northwind.svc.cs b/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/cs/northwind.svc.cs index 2dd9881f70c94..1fdfa84fe3bf8 100644 --- a/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/cs/northwind.svc.cs +++ b/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/cs/northwind.svc.cs @@ -22,7 +22,7 @@ public static void InitializeService(DataServiceConfiguration config) // based on the requirements of client applications. config.SetEntitySetAccessRule("Customers", EntitySetRights.AllRead); config.SetEntitySetAccessRule("Employees", EntitySetRights.ReadSingle); - config.SetEntitySetAccessRule("Orders", EntitySetRights.All + config.SetEntitySetAccessRule("Orders", EntitySetRights.All | EntitySetRights.WriteAppend | EntitySetRights.WriteMerge); config.SetEntitySetAccessRule("Order_Details", EntitySetRights.All); diff --git a/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/cs/northwind2.svc.cs b/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/cs/northwind2.svc.cs index 728915d2ef5ad..6ea1ea389c210 100644 --- a/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/cs/northwind2.svc.cs +++ b/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/cs/northwind2.svc.cs @@ -47,7 +47,7 @@ void ProcessingPipeline_ProcessingChangeset(object sender, EventArgs e) string body = reader.ReadToEnd(); } - //if (HttpContext.Current.Request.HttpMethod == "PUT" | + //if (HttpContext.Current.Request.HttpMethod == "PUT" | // HttpContext.Current.Request.HttpMethod == "MERGE") //{ // string path = HttpContext.Current.Request.Path; @@ -66,7 +66,7 @@ void ProcessingPipeline_ProcessingChangeset(object sender, EventArgs e) // object entity; // EntityKey ek = new EntityKey("NorthwindEntities.Order_Details", keyCol); - + // this.CurrentDataSource.TryGetObjectByKey(ek, out entity); // Order_Detail item = (Order_Detail)entity; @@ -138,7 +138,7 @@ public IQueryable GetOrdersByCity(string city) // [WebGet] - [SingleResult] + [SingleResult] public Order GetNewestOrder() { // Get the ObjectContext that is the data source for the service. @@ -192,7 +192,7 @@ public void ReturnsNoData() public Expression> OnQueryOrders() // { - // Filter the returned orders to only orders + // Filter the returned orders to only orders // that belong to a customer that is the current user. return o => o.Customer.ContactName == HttpContext.Current.User.Identity.Name; @@ -214,7 +214,7 @@ public void OnChangeProducts(Product product, UpdateOperations operations) .TryGetObjectStateEntry(product, out entry)) { // Reject changes to a discontinued Product. - // Because the update is already made to the entity by the time the + // Because the update is already made to the entity by the time the // change interceptor in invoked, check the original value of the Discontinued // property in the state entry and reject the change if 'true'. if ((bool)entry.OriginalValues["Discontinued"]) @@ -273,7 +273,7 @@ public void RaiseError() throw new DataServiceException(500, "My custom error message."); } // - + [WebInvoke(Method = "POST")] public IEnumerable GetCustomerNamesPost() { @@ -338,7 +338,7 @@ public IQueryable GetOrdersByState(string state, bool includeItems) public Customer CloneCustomer(string serializedCustomer) { NorthwindEntities context = this.CurrentDataSource; - + XmlSerializer xmlSerializer = new System.Xml.Serialization.XmlSerializer(typeof(Customer)); diff --git a/samples/snippets/csharp/VS_Snippets_Misc/astoria_photo_streaming_client/cs/photodata.cs b/samples/snippets/csharp/VS_Snippets_Misc/astoria_photo_streaming_client/cs/photodata.cs index 473123e9958a2..7f2964f56aa9d 100644 --- a/samples/snippets/csharp/VS_Snippets_Misc/astoria_photo_streaming_client/cs/photodata.cs +++ b/samples/snippets/csharp/VS_Snippets_Misc/astoria_photo_streaming_client/cs/photodata.cs @@ -12,7 +12,7 @@ // Generation date: 12/19/2010 10:42:52 PM namespace PhotoData { - + /// /// There are no comments for PhotoDataContainer in the schema. /// @@ -22,7 +22,7 @@ public partial class PhotoDataContainer : global::System.Data.Services.Client.Da /// Initialize a new PhotoDataContainer object. /// [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")] - public PhotoDataContainer(global::System.Uri serviceRoot) : + public PhotoDataContainer(global::System.Uri serviceRoot) : base(serviceRoot, global::System.Data.Services.Common.DataServiceProtocolVersion.V3) { this.OnContextCreated(); @@ -376,7 +376,7 @@ public Exposure Exposure { get { - if (((this._Exposure == null) + if (((this._Exposure == null) && (this._ExposureInitialized != true))) { this._Exposure = new Exposure(); @@ -407,7 +407,7 @@ public Dimensions Dimensions { get { - if (((this._Dimensions == null) + if (((this._Dimensions == null) && (this._DimensionsInitialized != true))) { this._Dimensions = new Dimensions(); diff --git a/samples/snippets/csharp/VS_Snippets_Misc/astoria_photo_streaming_client/cs/photodetailswindow.xaml.cs b/samples/snippets/csharp/VS_Snippets_Misc/astoria_photo_streaming_client/cs/photodetailswindow.xaml.cs index 7014845b2a17f..a3c328b60cebb 100644 --- a/samples/snippets/csharp/VS_Snippets_Misc/astoria_photo_streaming_client/cs/photodetailswindow.xaml.cs +++ b/samples/snippets/csharp/VS_Snippets_Misc/astoria_photo_streaming_client/cs/photodetailswindow.xaml.cs @@ -119,15 +119,15 @@ private bool SelectPhotoToSend() imageStream.Position = 0; // - // Set the file stream as the source of binary stream + // Set the file stream as the source of binary stream // to send to the data service. The Slug header is the file name and - // the content type is determined from the file extension. - // A value of 'true' means that the stream is closed by the client when + // the content type is determined from the file extension. + // A value of 'true' means that the stream is closed by the client when // the upload is complete. context.SetSaveStream(photoEntity, imageStream, true, photoEntity.ContentType, photoEntity.FileName); // - + return true; } else @@ -162,7 +162,7 @@ private void savePhotoDetails_Click(object sender, RoutedEventArgs e) ChangeOperationResponse response = context.SaveChanges().FirstOrDefault() as ChangeOperationResponse; - // When we issue a POST request, the photo ID and edit-media link are not updated + // When we issue a POST request, the photo ID and edit-media link are not updated // on the client (a bug), so we need to get the server values. if (photoEntity.PhotoId == 0) { @@ -174,7 +174,7 @@ private void savePhotoDetails_Click(object sender, RoutedEventArgs e) // Verify that the entity was created correctly. if (entity != null && entity.EditLink != null) { - // Cache the current merge option (we reset to the cached + // Cache the current merge option (we reset to the cached // value in the finally block). cachedMergeOption = context.MergeOption; diff --git a/samples/snippets/csharp/VS_Snippets_Misc/astoria_photo_streaming_client/cs/photowindow.xaml.cs b/samples/snippets/csharp/VS_Snippets_Misc/astoria_photo_streaming_client/cs/photowindow.xaml.cs index fb5c1480486b6..b978f81877d23 100644 --- a/samples/snippets/csharp/VS_Snippets_Misc/astoria_photo_streaming_client/cs/photowindow.xaml.cs +++ b/samples/snippets/csharp/VS_Snippets_Misc/astoria_photo_streaming_client/cs/photowindow.xaml.cs @@ -164,14 +164,14 @@ private void addPhoto_Click(object sender, RoutedEventArgs e) // Create a new PhotoInfo object. PhotoInfo newPhotoEntity = new PhotoInfo(); - // Ceate an new PhotoDetailsWindow instance with the current + // Ceate an new PhotoDetailsWindow instance with the current // context and the new photo entity. PhotoDetailsWindow addPhotoWindow = new PhotoDetailsWindow(newPhotoEntity, context); addPhotoWindow.Title = "Select a new photo to upload..."; - // We need to have the new entity tracked to be able to + // We need to have the new entity tracked to be able to // call DataServiceContext.SetSaveStream. trackedPhotos.Add(newPhotoEntity); diff --git a/samples/snippets/csharp/VS_Snippets_Misc/astoria_photo_streaming_service/cs/customcompression.cs b/samples/snippets/csharp/VS_Snippets_Misc/astoria_photo_streaming_service/cs/customcompression.cs index 907a49e1d7eac..07f771d96468e 100644 --- a/samples/snippets/csharp/VS_Snippets_Misc/astoria_photo_streaming_service/cs/customcompression.cs +++ b/samples/snippets/csharp/VS_Snippets_Misc/astoria_photo_streaming_service/cs/customcompression.cs @@ -12,7 +12,7 @@ class CustomCompressionInspector : IDispatchMessageInspector { // Assume utf-8, note that Data Services supports // charset negotation, so this needs to be more - // sophisticated (and per-request) if clients will + // sophisticated (and per-request) if clients will // use multiple charsets private static Encoding encoding = Encoding.UTF8; @@ -33,7 +33,7 @@ public object AfterReceiveRequest(ref System.ServiceModel.Channels.Message reque //// due to use of a reserved option (starts with "$") //match.QueryParameters.Remove("$format"); - // replace the Accept header so that the Data Services runtime + // replace the Accept header so that the Data Services runtime // assumes the client asked for a JSON representation if (httpmsg.Headers["Compress-Data"] == "true") { @@ -109,8 +109,8 @@ public class CustomCompressionInspectorAttribute : Attribute, IServiceBehavior { #region IServiceBehavior Members - void IServiceBehavior.AddBindingParameters(ServiceDescription serviceDescription, - ServiceHostBase serviceHostBase, System.Collections.ObjectModel.Collection endpoints, + void IServiceBehavior.AddBindingParameters(ServiceDescription serviceDescription, + ServiceHostBase serviceHostBase, System.Collections.ObjectModel.Collection endpoints, System.ServiceModel.Channels.BindingParameterCollection bindingParameters) { } diff --git a/samples/snippets/csharp/VS_Snippets_Misc/astoria_photo_streaming_service/cs/photodata.svc.cs b/samples/snippets/csharp/VS_Snippets_Misc/astoria_photo_streaming_service/cs/photodata.svc.cs index 941c4a1bb5f9c..380373fdf5e3a 100644 --- a/samples/snippets/csharp/VS_Snippets_Misc/astoria_photo_streaming_service/cs/photodata.svc.cs +++ b/samples/snippets/csharp/VS_Snippets_Misc/astoria_photo_streaming_service/cs/photodata.svc.cs @@ -32,7 +32,7 @@ public object GetService(Type serviceType) // Return the stream provider to the data service. return new PhotoServiceStreamProvider(this.CurrentDataSource); } - + return null; } } diff --git a/samples/snippets/csharp/VS_Snippets_Misc/astoria_photo_streaming_service/cs/photoservicestreamprovider.cs b/samples/snippets/csharp/VS_Snippets_Misc/astoria_photo_streaming_service/cs/photoservicestreamprovider.cs index 607c3bdbf6eaa..42cfa241ad710 100644 --- a/samples/snippets/csharp/VS_Snippets_Misc/astoria_photo_streaming_service/cs/photoservicestreamprovider.cs +++ b/samples/snippets/csharp/VS_Snippets_Misc/astoria_photo_streaming_service/cs/photoservicestreamprovider.cs @@ -16,7 +16,7 @@ class PhotoServiceStreamProvider : IDataServiceStreamProvider, IDisposable private string imageFilePath; private PhotoInfo cachedEntity; private PhotoDataContainer context; - + private string tempFile; public PhotoServiceStreamProvider(PhotoDataContainer context) @@ -54,8 +54,8 @@ public Stream GetReadStream(object entity, string etag, bool? { if (checkETagForEquality != null) { - // This stream provider implementation does not support - // ETag headers for media resources. This means that we do not track + // This stream provider implementation does not support + // ETag headers for media resources. This means that we do not track // concurrency for a media resource and last-in wins on updates. throw new DataServiceException(400, "This sample service does not support the ETag header for a media resource."); @@ -97,7 +97,7 @@ public string GetStreamContentType(object entity, DataServiceOperationContext op public string GetStreamETag(object entity, DataServiceOperationContext operationContext) { // This sample provider does not support the eTag header with media resources. - // This means that we do not track concurrency for a media resource + // This means that we do not track concurrency for a media resource // and last-in wins on updates. return null; } @@ -107,7 +107,7 @@ public Stream GetWriteStream(object entity, string etag, bool? if (checkETagForEquality != null) { // This stream provider implementation does not support ETags associated with BLOBs. - // This means that we do not track concurrency for a media resource + // This means that we do not track concurrency for a media resource // and last-in wins on updates. throw new DataServiceException(400, "This demo does not support ETags associated with BLOBs"); @@ -124,9 +124,9 @@ public Stream GetWriteStream(object entity, string etag, bool? // Handle the POST request. if (operationContext.RequestMethod == "POST") { - // Set the file name from the Slug header; if we don't have a - // Slug header, just set a temporary name which is overwritten - // by the subsequent MERGE request from the client. + // Set the file name from the Slug header; if we don't have a + // Slug header, just set a temporary name which is overwritten + // by the subsequent MERGE request from the client. image.FileName = operationContext.RequestHeaders["Slug"] ?? "newFile"; // Set the required DateTime values. @@ -136,7 +136,7 @@ public Stream GetWriteStream(object entity, string etag, bool? // Set the content type, which cannot be null. image.ContentType = operationContext.RequestHeaders["Content-Type"]; - // Cache the current entity to enable us to both create a key based storage file name + // Cache the current entity to enable us to both create a key based storage file name // and to maintain transactional integrity in the disposer; we do this only for a POST request. cachedEntity = image; @@ -186,7 +186,7 @@ public void Dispose() if (entry.State == System.Data.EntityState.Unchanged) { - // Since the entity was created successfully, move the temp file into the + // Since the entity was created successfully, move the temp file into the // storage directory and rename the file based on the new entity key. File.Move(tempFile, newImageFileName); @@ -204,7 +204,7 @@ public void Dispose() } else { - // A problem must have occurred when saving the entity to the database, + // A problem must have occurred when saving the entity to the database, // so we should delete the entity and temp file. context.DeleteObject(cachedEntity); File.Delete(tempFile); diff --git a/samples/snippets/csharp/VS_Snippets_Misc/astoria_photo_streaming_service/cs/settings.cs b/samples/snippets/csharp/VS_Snippets_Misc/astoria_photo_streaming_service/cs/settings.cs index c304d0b2823f4..44f6142e36cbe 100644 --- a/samples/snippets/csharp/VS_Snippets_Misc/astoria_photo_streaming_service/cs/settings.cs +++ b/samples/snippets/csharp/VS_Snippets_Misc/astoria_photo_streaming_service/cs/settings.cs @@ -6,7 +6,7 @@ // The SettingsLoaded event is raised after the setting values are loaded. // The SettingsSaving event is raised before the setting values are saved. internal sealed partial class Settings { - + public Settings() { // // To add event handlers for saving and changing settings, uncomment the lines below: // @@ -15,11 +15,11 @@ public Settings() { // this.SettingsSaving += this.SettingsSavingEventHandler; // } - + private void SettingChangingEventHandler(object sender, System.Configuration.SettingChangingEventArgs e) { // Add code to handle the SettingChangingEvent event here. } - + private void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e) { // Add code to handle the SettingsSaving event here. } diff --git a/samples/snippets/csharp/VS_Snippets_Misc/astoria_quickstart_client/cs/northwind.cs b/samples/snippets/csharp/VS_Snippets_Misc/astoria_quickstart_client/cs/northwind.cs index faab3085086c5..662c25c22393a 100644 --- a/samples/snippets/csharp/VS_Snippets_Misc/astoria_quickstart_client/cs/northwind.cs +++ b/samples/snippets/csharp/VS_Snippets_Misc/astoria_quickstart_client/cs/northwind.cs @@ -12,7 +12,7 @@ // Generation date: 10/2/2009 11:52:32 AM namespace NorthwindModel { - + /// /// There are no comments for NorthwindEntities in the schema. /// @@ -22,7 +22,7 @@ public partial class NorthwindEntities : global::System.Data.Services.Client.Dat /// Initialize a new NorthwindEntities object. /// [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")] - public NorthwindEntities(global::System.Uri serviceRoot) : + public NorthwindEntities(global::System.Uri serviceRoot) : base(serviceRoot) { this.OnContextCreated(); diff --git a/samples/snippets/csharp/VS_Snippets_Misc/astoria_quickstart_client/cs/window1.xaml.cs b/samples/snippets/csharp/VS_Snippets_Misc/astoria_quickstart_client/cs/window1.xaml.cs index 40dd53d38d84d..747f7b297d129 100644 --- a/samples/snippets/csharp/VS_Snippets_Misc/astoria_quickstart_client/cs/window1.xaml.cs +++ b/samples/snippets/csharp/VS_Snippets_Misc/astoria_quickstart_client/cs/window1.xaml.cs @@ -30,7 +30,7 @@ public Window1() private NorthwindEntities context; private string customerId = "ALFKI"; - // Replace the host server and port number with the values + // Replace the host server and port number with the values // for the test server hosting your Northwind data service instance. private Uri svcUri = new Uri("http://localhost:12345/Northwind.svc"); @@ -43,13 +43,13 @@ private void Window1_Loaded(object sender, RoutedEventArgs e) context.IgnoreMissingProperties = true; - // Define a LINQ query that returns Orders and + // Define a LINQ query that returns Orders and // Order_Details for a specific customer. var ordersQuery = from o in context.Orders.Expand("Order_Details") where o.Customer.CustomerID == customerId select o; - // Create an DataServiceCollection based on + // Create an DataServiceCollection based on // execution of the LINQ query for Orders. DataServiceCollection customerOrders = new DataServiceCollection(ordersQuery); @@ -82,6 +82,6 @@ private void buttonClose_Click(object sender, RoutedEventArgs e) { this.Close(); } - // + // } } diff --git a/samples/snippets/csharp/VS_Snippets_Misc/astoria_quickstart_service/cs/default.aspx.designer.cs b/samples/snippets/csharp/VS_Snippets_Misc/astoria_quickstart_service/cs/default.aspx.designer.cs index 243bb7a3cd625..f8652f9f57a21 100644 --- a/samples/snippets/csharp/VS_Snippets_Misc/astoria_quickstart_service/cs/default.aspx.designer.cs +++ b/samples/snippets/csharp/VS_Snippets_Misc/astoria_quickstart_service/cs/default.aspx.designer.cs @@ -9,10 +9,10 @@ //------------------------------------------------------------------------------ namespace NorthwindService { - - + + public partial class _Default { - + /// /// form1 control. /// diff --git a/samples/snippets/csharp/VS_Snippets_Misc/astoria_quickstart_service/cs/northwind.designer.cs b/samples/snippets/csharp/VS_Snippets_Misc/astoria_quickstart_service/cs/northwind.designer.cs index a7bddd1a93f56..94208569b88c3 100644 --- a/samples/snippets/csharp/VS_Snippets_Misc/astoria_quickstart_service/cs/northwind.designer.cs +++ b/samples/snippets/csharp/VS_Snippets_Misc/astoria_quickstart_service/cs/northwind.designer.cs @@ -35,14 +35,14 @@ namespace NorthwindService { #region Contexts - + /// /// No Metadata Documentation available. /// public partial class NorthwindEntities : ObjectContext { #region Constructors - + /// /// Initializes a new NorthwindEntities object using the connection string found in the 'NorthwindEntities' section of the application configuration file. /// @@ -51,7 +51,7 @@ public NorthwindEntities() : base("name=NorthwindEntities", "NorthwindEntities") this.ContextOptions.LazyLoadingEnabled = true; OnContextCreated(); } - + /// /// Initialize a new NorthwindEntities object. /// @@ -60,7 +60,7 @@ public NorthwindEntities(string connectionString) : base(connectionString, "Nort this.ContextOptions.LazyLoadingEnabled = true; OnContextCreated(); } - + /// /// Initialize a new NorthwindEntities object. /// @@ -69,17 +69,17 @@ public NorthwindEntities(EntityConnection connection) : base(connection, "Northw this.ContextOptions.LazyLoadingEnabled = true; OnContextCreated(); } - + #endregion - + #region Partial Methods - + partial void OnContextCreated(); - + #endregion - + #region ObjectSet Properties - + /// /// No Metadata Documentation available. /// @@ -95,7 +95,7 @@ public ObjectSet Categories } } private ObjectSet _Categories; - + /// /// No Metadata Documentation available. /// @@ -111,7 +111,7 @@ public ObjectSet CustomerDemographics } } private ObjectSet _CustomerDemographics; - + /// /// No Metadata Documentation available. /// @@ -127,7 +127,7 @@ public ObjectSet Customers } } private ObjectSet _Customers; - + /// /// No Metadata Documentation available. /// diff --git a/samples/snippets/csharp/VS_Snippets_Misc/astoria_quickstart_service/cs/northwind.svc.cs b/samples/snippets/csharp/VS_Snippets_Misc/astoria_quickstart_service/cs/northwind.svc.cs index 217e8918ce2f8..ec87f38ebfbd5 100644 --- a/samples/snippets/csharp/VS_Snippets_Misc/astoria_quickstart_service/cs/northwind.svc.cs +++ b/samples/snippets/csharp/VS_Snippets_Misc/astoria_quickstart_service/cs/northwind.svc.cs @@ -15,8 +15,8 @@ public static void InitializeService(DataServiceConfiguration config) { // // Grant only the rights needed to support the client application. - config.SetEntitySetAccessRule("Orders", EntitySetRights.AllRead - | EntitySetRights.WriteMerge + config.SetEntitySetAccessRule("Orders", EntitySetRights.AllRead + | EntitySetRights.WriteMerge | EntitySetRights.WriteReplace ); config.SetEntitySetAccessRule("Order_Details", EntitySetRights.AllRead | EntitySetRights.AllWrite); diff --git a/samples/snippets/csharp/buffers/MyClass.cs b/samples/snippets/csharp/buffers/MyClass.cs index 7462bf823cc2a..6cf7f5967ec82 100644 --- a/samples/snippets/csharp/buffers/MyClass.cs +++ b/samples/snippets/csharp/buffers/MyClass.cs @@ -60,7 +60,7 @@ bool TryParseHeaderLength(ref ReadOnlySequence buffer, out int length) } else { - // There are 4 bytes split across multiple segments. Since it's so small, it + // There are 4 bytes split across multiple segments. Since it's so small, it // can be copied to a stack allocated buffer. This avoids a heap allocation. Span stackBuffer = stackalloc byte[4]; lengthSlice.CopyTo(stackBuffer); @@ -158,7 +158,7 @@ static void EmptySegments() // sequence1.FirstSpan.Length=1 Console.WriteLine($"sequence1.FirstSpan.Length={sequence1.FirstSpan.Length}"); - // Slicing using SequencePosition will Slice the ReadOnlySequence directly + // Slicing using SequencePosition will Slice the ReadOnlySequence directly // on the empty segment! // sequence2.FirstSpan.Length=0 Console.WriteLine($"sequence2.FirstSpan.Length={sequence2.FirstSpan.Length}"); @@ -280,7 +280,7 @@ public static class MyClass3 #region snippet10 static ReadOnlySpan NewLine => new byte[] { (byte)'\r', (byte)'\n' }; - static bool TryParseLine(ref ReadOnlySequence buffer, + static bool TryParseLine(ref ReadOnlySequence buffer, out ReadOnlySequence line) { var reader = new SequenceReader(buffer); diff --git a/samples/snippets/csharp/classes-quickstart/BankAccount.cs b/samples/snippets/csharp/classes-quickstart/BankAccount.cs index 6dd1c226a3c6b..c7854de8644bc 100644 --- a/samples/snippets/csharp/classes-quickstart/BankAccount.cs +++ b/samples/snippets/csharp/classes-quickstart/BankAccount.cs @@ -8,7 +8,7 @@ public class BankAccount public string Number { get; } public string Owner { get; set; } #region BalanceComputation - public decimal Balance + public decimal Balance { get { diff --git a/samples/snippets/csharp/concepts/basic-types/type-safety.cs b/samples/snippets/csharp/concepts/basic-types/type-safety.cs index b0c4bb315e6f6..99007726809bb 100644 --- a/samples/snippets/csharp/concepts/basic-types/type-safety.cs +++ b/samples/snippets/csharp/concepts/basic-types/type-safety.cs @@ -1,4 +1,4 @@ -int a = 5; +int a = 5; int b = a + 2; //OK bool test = true; diff --git a/samples/snippets/csharp/concepts/codedoc/exception-tag.cs b/samples/snippets/csharp/concepts/codedoc/exception-tag.cs index 068e150ce8399..780a19bbf1539 100644 --- a/samples/snippets/csharp/concepts/codedoc/exception-tag.cs +++ b/samples/snippets/csharp/concepts/codedoc/exception-tag.cs @@ -23,7 +23,7 @@ public class Math /// } /// /// - /// Thrown when one parameter is max + /// Thrown when one parameter is max /// and the other is greater than 0. public static int Add(int a, int b) { @@ -39,7 +39,7 @@ public static int Add(int a, int b) /// /// The sum of two doubles. /// - /// Thrown when one parameter is max + /// Thrown when one parameter is max /// and the other is greater than zero. public static double Add(double a, double b) { diff --git a/samples/snippets/csharp/concepts/codedoc/inheritdoc-tag.cs b/samples/snippets/csharp/concepts/codedoc/inheritdoc-tag.cs index 929e3960ab871..32f4fc59bc8b1 100644 --- a/samples/snippets/csharp/concepts/codedoc/inheritdoc-tag.cs +++ b/samples/snippets/csharp/concepts/codedoc/inheritdoc-tag.cs @@ -1,5 +1,5 @@ /* - The IMath interface + The IMath interface The main Math class Contains all methods for performing basic math functions */ diff --git a/samples/snippets/csharp/concepts/codedoc/param-tag.cs b/samples/snippets/csharp/concepts/codedoc/param-tag.cs index b95431d11ab71..9314029c403c9 100644 --- a/samples/snippets/csharp/concepts/codedoc/param-tag.cs +++ b/samples/snippets/csharp/concepts/codedoc/param-tag.cs @@ -14,7 +14,7 @@ public class Math /// /// The sum of two doubles. /// - /// Thrown when one parameter is max + /// Thrown when one parameter is max /// and the other is greater than zero. /// See to add integers. /// A double precision number. diff --git a/samples/snippets/csharp/concepts/codedoc/paramref-tag.cs b/samples/snippets/csharp/concepts/codedoc/paramref-tag.cs index e8711f28674d1..ffbe79e86dfc9 100644 --- a/samples/snippets/csharp/concepts/codedoc/paramref-tag.cs +++ b/samples/snippets/csharp/concepts/codedoc/paramref-tag.cs @@ -14,7 +14,7 @@ public class Math /// /// The sum of two doubles. /// - /// Thrown when one parameter is max + /// Thrown when one parameter is max /// and the other is greater than zero. /// See to add integers. /// A double precision number. diff --git a/samples/snippets/csharp/concepts/codedoc/see-tag.cs b/samples/snippets/csharp/concepts/codedoc/see-tag.cs index 52afa4091dfd1..a29dfcf27369a 100644 --- a/samples/snippets/csharp/concepts/codedoc/see-tag.cs +++ b/samples/snippets/csharp/concepts/codedoc/see-tag.cs @@ -23,7 +23,7 @@ public class Math /// } /// /// - /// Thrown when one parameter is max + /// Thrown when one parameter is max /// and the other is greater than 0. /// See to add doubles. public static int Add(int a, int b) @@ -40,7 +40,7 @@ public static int Add(int a, int b) /// /// The sum of two doubles. /// - /// Thrown when one parameter is max + /// Thrown when one parameter is max /// and the other is greater than zero. /// See to add integers. public static double Add(double a, double b) diff --git a/samples/snippets/csharp/concepts/codedoc/seealso-tag.cs b/samples/snippets/csharp/concepts/codedoc/seealso-tag.cs index c24019cb42fc1..6f40105455e75 100644 --- a/samples/snippets/csharp/concepts/codedoc/seealso-tag.cs +++ b/samples/snippets/csharp/concepts/codedoc/seealso-tag.cs @@ -23,7 +23,7 @@ public class Math /// } /// /// - /// Thrown when one parameter is max + /// Thrown when one parameter is max /// and the other is greater than 0. /// See to add doubles. /// diff --git a/samples/snippets/csharp/concepts/codedoc/tagged-library.cs b/samples/snippets/csharp/concepts/codedoc/tagged-library.cs index 1030a892e2425..ead203e889296 100644 --- a/samples/snippets/csharp/concepts/codedoc/tagged-library.cs +++ b/samples/snippets/csharp/concepts/codedoc/tagged-library.cs @@ -46,7 +46,7 @@ public class Math /// } /// /// - /// Thrown when one parameter is max + /// Thrown when one parameter is max /// and the other is greater than 0. /// See to add doubles. /// @@ -80,7 +80,7 @@ public static int Add(int a, int b) /// } /// /// - /// Thrown when one parameter is max + /// Thrown when one parameter is max /// and the other is greater than 0. /// See to add integers. /// diff --git a/samples/snippets/csharp/concepts/linq/how-to-create-a-nested-group_1.cs b/samples/snippets/csharp/concepts/linq/how-to-create-a-nested-group_1.cs index 215c08b6d7748..8c158568f9f80 100644 --- a/samples/snippets/csharp/concepts/linq/how-to-create-a-nested-group_1.cs +++ b/samples/snippets/csharp/concepts/linq/how-to-create-a-nested-group_1.cs @@ -8,8 +8,8 @@ from newGroup2 in group student by student.LastName) group newGroup2 by newGroup1.Key; - // Three nested foreach loops are required to iterate - // over all elements of a grouped group. Hover the mouse + // Three nested foreach loops are required to iterate + // over all elements of a grouped group. Hover the mouse // cursor over the iteration variables to see their actual type. foreach (var outerGroup in queryNestedGroups) { @@ -53,5 +53,5 @@ Garcia Cesar Names that begin with: O'Donnell O'Donnell Claire Names that begin with: Zabokritski - Zabokritski Eugene + Zabokritski Eugene */ \ No newline at end of file diff --git a/samples/snippets/csharp/concepts/linq/how-to-dynamically-specify-predicate-filters-at-runtime_2.cs b/samples/snippets/csharp/concepts/linq/how-to-dynamically-specify-predicate-filters-at-runtime_2.cs index 4f3cd7217964a..7095d605b5c19 100644 --- a/samples/snippets/csharp/concepts/linq/how-to-dynamically-specify-predicate-filters-at-runtime_2.cs +++ b/samples/snippets/csharp/concepts/linq/how-to-dynamically-specify-predicate-filters-at-runtime_2.cs @@ -1,6 +1,6 @@  // To run this sample, first specify an integer value of 1 to 4 for the command // line. This number will be converted to a GradeLevel value that specifies which - // set of students to query. + // set of students to query. // Call the method: QueryByYear(args[0]); static void QueryByYear(string level) diff --git a/samples/snippets/csharp/concepts/linq/how-to-group-query-results_1.cs b/samples/snippets/csharp/concepts/linq/how-to-group-query-results_1.cs index a974ddf1ae732..c626ca6f7bb60 100644 --- a/samples/snippets/csharp/concepts/linq/how-to-group-query-results_1.cs +++ b/samples/snippets/csharp/concepts/linq/how-to-group-query-results_1.cs @@ -13,41 +13,41 @@ protected class Student protected static List students = new List { - new Student {FirstName = "Terry", LastName = "Adams", ID = 120, - Year = GradeLevel.SecondYear, + new Student {FirstName = "Terry", LastName = "Adams", ID = 120, + Year = GradeLevel.SecondYear, ExamScores = new List{ 99, 82, 81, 79}}, - new Student {FirstName = "Fadi", LastName = "Fakhouri", ID = 116, + new Student {FirstName = "Fadi", LastName = "Fakhouri", ID = 116, Year = GradeLevel.ThirdYear, ExamScores = new List{ 99, 86, 90, 94}}, - new Student {FirstName = "Hanying", LastName = "Feng", ID = 117, - Year = GradeLevel.FirstYear, + new Student {FirstName = "Hanying", LastName = "Feng", ID = 117, + Year = GradeLevel.FirstYear, ExamScores = new List{ 93, 92, 80, 87}}, - new Student {FirstName = "Cesar", LastName = "Garcia", ID = 114, + new Student {FirstName = "Cesar", LastName = "Garcia", ID = 114, Year = GradeLevel.FourthYear, ExamScores = new List{ 97, 89, 85, 82}}, - new Student {FirstName = "Debra", LastName = "Garcia", ID = 115, - Year = GradeLevel.ThirdYear, + new Student {FirstName = "Debra", LastName = "Garcia", ID = 115, + Year = GradeLevel.ThirdYear, ExamScores = new List{ 35, 72, 91, 70}}, - new Student {FirstName = "Hugo", LastName = "Garcia", ID = 118, - Year = GradeLevel.SecondYear, + new Student {FirstName = "Hugo", LastName = "Garcia", ID = 118, + Year = GradeLevel.SecondYear, ExamScores = new List{ 92, 90, 83, 78}}, - new Student {FirstName = "Sven", LastName = "Mortensen", ID = 113, - Year = GradeLevel.FirstYear, + new Student {FirstName = "Sven", LastName = "Mortensen", ID = 113, + Year = GradeLevel.FirstYear, ExamScores = new List{ 88, 94, 65, 91}}, - new Student {FirstName = "Claire", LastName = "O'Donnell", ID = 112, - Year = GradeLevel.FourthYear, + new Student {FirstName = "Claire", LastName = "O'Donnell", ID = 112, + Year = GradeLevel.FourthYear, ExamScores = new List{ 75, 84, 91, 39}}, - new Student {FirstName = "Svetlana", LastName = "Omelchenko", ID = 111, - Year = GradeLevel.SecondYear, + new Student {FirstName = "Svetlana", LastName = "Omelchenko", ID = 111, + Year = GradeLevel.SecondYear, ExamScores = new List{ 97, 92, 81, 60}}, - new Student {FirstName = "Lance", LastName = "Tucker", ID = 119, - Year = GradeLevel.ThirdYear, + new Student {FirstName = "Lance", LastName = "Tucker", ID = 119, + Year = GradeLevel.ThirdYear, ExamScores = new List{ 68, 79, 88, 92}}, - new Student {FirstName = "Michael", LastName = "Tucker", ID = 122, - Year = GradeLevel.FirstYear, + new Student {FirstName = "Michael", LastName = "Tucker", ID = 122, + Year = GradeLevel.FirstYear, ExamScores = new List{ 94, 92, 91, 91}}, new Student {FirstName = "Eugene", LastName = "Zabokritski", ID = 121, - Year = GradeLevel.FourthYear, + Year = GradeLevel.FourthYear, ExamScores = new List{ 96, 85, 91, 60}} }; #endregion diff --git a/samples/snippets/csharp/concepts/linq/how-to-group-query-results_2.cs b/samples/snippets/csharp/concepts/linq/how-to-group-query-results_2.cs index 7d896eec88c4f..a0e15fb062634 100644 --- a/samples/snippets/csharp/concepts/linq/how-to-group-query-results_2.cs +++ b/samples/snippets/csharp/concepts/linq/how-to-group-query-results_2.cs @@ -2,8 +2,8 @@ { Console.WriteLine("Group by a single property in an object:"); - // Variable queryLastNames is an IEnumerable>. + // Variable queryLastNames is an IEnumerable>. var queryLastNames = from student in students group student by student.LastName into newGroup diff --git a/samples/snippets/csharp/concepts/linq/how-to-group-query-results_3.cs b/samples/snippets/csharp/concepts/linq/how-to-group-query-results_3.cs index bd089ef8e2865..546bd28eae4e4 100644 --- a/samples/snippets/csharp/concepts/linq/how-to-group-query-results_3.cs +++ b/samples/snippets/csharp/concepts/linq/how-to-group-query-results_3.cs @@ -1,5 +1,5 @@  public void GroupBySubstring() - { + { Console.WriteLine("\r\nGroup by something other than a property of the object:"); var queryFirstLetters = @@ -14,7 +14,7 @@ from student in students { Console.WriteLine($"\t{student.LastName}, {student.FirstName}"); } - } + } } /* Output: Group by something other than a property of the object: diff --git a/samples/snippets/csharp/concepts/linq/how-to-group-query-results_5.cs b/samples/snippets/csharp/concepts/linq/how-to-group-query-results_5.cs index 181c291842823..60106c85bc04e 100644 --- a/samples/snippets/csharp/concepts/linq/how-to-group-query-results_5.cs +++ b/samples/snippets/csharp/concepts/linq/how-to-group-query-results_5.cs @@ -1,5 +1,5 @@  public void GroupByRange() - { + { Console.WriteLine("\r\nGroup by numeric range and project into a new anonymous type:"); var queryNumericRange = @@ -12,12 +12,12 @@ orderby percentGroup.Key // Nested foreach required to iterate over groups and group items. foreach (var studentGroup in queryNumericRange) { - Console.WriteLine($"Key: {studentGroup.Key * 10}"); + Console.WriteLine($"Key: {studentGroup.Key * 10}"); foreach (var item in studentGroup) { Console.WriteLine($"\t{item.LastName}, {item.FirstName}"); } - } + } } /* Output: Group by numeric range and project into a new anonymous type: diff --git a/samples/snippets/csharp/concepts/linq/how-to-group-query-results_6.cs b/samples/snippets/csharp/concepts/linq/how-to-group-query-results_6.cs index 601d5446f7e67..f2ee1bddcccba 100644 --- a/samples/snippets/csharp/concepts/linq/how-to-group-query-results_6.cs +++ b/samples/snippets/csharp/concepts/linq/how-to-group-query-results_6.cs @@ -1,5 +1,5 @@  public void GroupByBoolean() - { + { Console.WriteLine("\r\nGroup by a Boolean into two groups with string keys"); Console.WriteLine("\"True\" and \"False\" and project into a new anonymous type:"); var queryGroupByAverages = from student in students @@ -12,7 +12,7 @@ by student.ExamScores.Average() > 75 into studentGroup Console.WriteLine($"Key: {studentGroup.Key}"); foreach (var student in studentGroup) Console.WriteLine($"\t{student.FirstName} {student.LastName}"); - } + } } /* Output: Group by a Boolean into two groups with string keys diff --git a/samples/snippets/csharp/concepts/linq/how-to-group-query-results_7.cs b/samples/snippets/csharp/concepts/linq/how-to-group-query-results_7.cs index b59de0c156c48..f8b495aacb360 100644 --- a/samples/snippets/csharp/concepts/linq/how-to-group-query-results_7.cs +++ b/samples/snippets/csharp/concepts/linq/how-to-group-query-results_7.cs @@ -2,7 +2,7 @@ { var queryHighScoreGroups = from student in students - group student by new { FirstLetter = student.LastName[0], + group student by new { FirstLetter = student.LastName[0], Score = student.ExamScores[0] > 85 } into studentGroup orderby studentGroup.Key.FirstLetter select studentGroup; @@ -18,7 +18,7 @@ orderby studentGroup.Key.FirstLetter } } } - + /* Output: Group and order by a compound key: Name starts with A who scored more than 85 diff --git a/samples/snippets/csharp/concepts/linq/how-to-group-results-by-contiguous-keys_1.cs b/samples/snippets/csharp/concepts/linq/how-to-group-results-by-contiguous-keys_1.cs index 36b5d0c5a6545..f0fad26a1d090 100644 --- a/samples/snippets/csharp/concepts/linq/how-to-group-results-by-contiguous-keys_1.cs +++ b/samples/snippets/csharp/concepts/linq/how-to-group-results-by-contiguous-keys_1.cs @@ -17,7 +17,7 @@ public static IEnumerable> ChunkBy(this // Flag to signal end of source sequence. const bool noMoreSourceElements = true; - // Auto-generated iterator for the source array. + // Auto-generated iterator for the source array. var enumerator = source.GetEnumerator(); // Move to the first element in the source sequence. @@ -42,7 +42,7 @@ public static IEnumerable> ChunkBy(this // returned only when the client code foreach's over this chunk. See Chunk.GetEnumerator for more info. yield return current; - // Check to see whether (a) the chunk has made a copy of all its source elements or + // Check to see whether (a) the chunk has made a copy of all its source elements or // (b) the iterator has reached the end of the source sequence. If the caller uses an inner // foreach loop to iterate the chunk items, and that loop ran to completion, // then the Chunk.GetEnumerator method will already have made @@ -56,11 +56,11 @@ public static IEnumerable> ChunkBy(this } } - // A Chunk is a contiguous group of one or more source elements that have the same key. A Chunk + // A Chunk is a contiguous group of one or more source elements that have the same key. A Chunk // has a key and a list of ChunkItem objects, which are copies of the elements in the source sequence. class Chunk : IGrouping { - // INVARIANT: DoneCopyingChunk == true || + // INVARIANT: DoneCopyingChunk == true || // (predicate != null && predicate(enumerator.Current) && current.Value == enumerator.Current) // A Chunk has a linked list of ChunkItems, which represent the elements in the current chunk. Each ChunkItem @@ -114,7 +114,7 @@ public Chunk(TKey key, IEnumerator enumerator, Func pred m_Lock = new object(); } - // Indicates that all chunk elements have been copied to the list of ChunkItems, + // Indicates that all chunk elements have been copied to the list of ChunkItems, // and the source enumerator is either at the end, or else on an element with a new key. // the tail of the linked list is set to null in the CopyNextChunkElement method if the // key of the next element does not match the current chunk's key, or there are no more elements in the source. @@ -146,7 +146,7 @@ private void CopyNextChunkElement() } // Called after the end of the last chunk was reached. It first checks whether - // there are more elements in the source sequence. If there are, it + // there are more elements in the source sequence. If there are, it // Returns true if enumerator for this chunk was exhausted. internal bool CopyAllChunkElements() { @@ -185,7 +185,7 @@ public IEnumerator GetEnumerator() // Yield the current item in the list. yield return current.Value; - // Copy the next item from the source sequence, + // Copy the next item from the source sequence, // if we are at the end of our local list. lock (m_Lock) { diff --git a/samples/snippets/csharp/concepts/linq/how-to-handle-exceptions-in-query-expressions_1.cs b/samples/snippets/csharp/concepts/linq/how-to-handle-exceptions-in-query-expressions_1.cs index 8392e048ddf11..a8b20fc1c7722 100644 --- a/samples/snippets/csharp/concepts/linq/how-to-handle-exceptions-in-query-expressions_1.cs +++ b/samples/snippets/csharp/concepts/linq/how-to-handle-exceptions-in-query-expressions_1.cs @@ -12,12 +12,12 @@ static void Main() } catch (InvalidOperationException) { - // Handle (or don't handle) the exception + // Handle (or don't handle) the exception // in the way that is appropriate for your application. Console.WriteLine("Invalid operation"); goto Exit; } - + // If we get here, it is safe to proceed. var query = from i in dataSource select i * i; diff --git a/samples/snippets/csharp/concepts/linq/how-to-order-the-results-of-a-join-clause_1.cs b/samples/snippets/csharp/concepts/linq/how-to-order-the-results-of-a-join-clause_1.cs index c1f485ce2c1a7..5b8b9fa00436b 100644 --- a/samples/snippets/csharp/concepts/linq/how-to-order-the-results-of-a-join-clause_1.cs +++ b/samples/snippets/csharp/concepts/linq/how-to-order-the-results-of-a-join-clause_1.cs @@ -15,12 +15,12 @@ class Category // Specify the first data source. List categories = new List() - { + { new Category(){Name="Beverages", ID=001}, new Category(){ Name="Condiments", ID=002}, new Category(){ Name="Vegetables", ID=003}, new Category() { Name="Grains", ID=004}, - new Category() { Name="Fruit", ID=005} + new Category() { Name="Fruit", ID=005} }; // Specify the second data source. diff --git a/samples/snippets/csharp/concepts/linq/how-to-perform-custom-join-operations_1.cs b/samples/snippets/csharp/concepts/linq/how-to-perform-custom-join-operations_1.cs index 4583563f065c5..e004dffc71ab9 100644 --- a/samples/snippets/csharp/concepts/linq/how-to-perform-custom-join-operations_1.cs +++ b/samples/snippets/csharp/concepts/linq/how-to-perform-custom-join-operations_1.cs @@ -17,10 +17,10 @@ class Category // Specify the first data source. List categories = new List() - { + { new Category(){Name="Beverages", ID=001}, new Category(){ Name="Condiments", ID=002}, - new Category(){ Name="Vegetables", ID=003}, + new Category(){ Name="Vegetables", ID=003}, }; // Specify the second data source. diff --git a/samples/snippets/csharp/concepts/linq/how-to-perform-custom-join-operations_2.cs b/samples/snippets/csharp/concepts/linq/how-to-perform-custom-join-operations_2.cs index 2ff2259703689..b213b17e09ce0 100644 --- a/samples/snippets/csharp/concepts/linq/how-to-perform-custom-join-operations_2.cs +++ b/samples/snippets/csharp/concepts/linq/how-to-perform-custom-join-operations_2.cs @@ -50,7 +50,7 @@ class Student public List ExamScores { get; set; } } - /* Output: + /* Output: The average score of Omelchenko Svetlana is 82.5. The average score of O'Donnell Claire is 72.25. The average score of Mortensen Sven is 84.5. diff --git a/samples/snippets/csharp/concepts/linq/how-to-perform-grouped-joins_1.cs b/samples/snippets/csharp/concepts/linq/how-to-perform-grouped-joins_1.cs index 40006e9da8f35..d68bd797f33ae 100644 --- a/samples/snippets/csharp/concepts/linq/how-to-perform-grouped-joins_1.cs +++ b/samples/snippets/csharp/concepts/linq/how-to-perform-grouped-joins_1.cs @@ -31,7 +31,7 @@ public static void GroupJoinExample() List pets = new List { barley, boots, whiskers, bluemoon, daisy }; // Create a list where each element is an anonymous type - // that contains the person's first name and a collection of + // that contains the person's first name and a collection of // pets that are owned by them. var query = from person in people join pet in pets on person equals pet.Owner into gj diff --git a/samples/snippets/csharp/concepts/linq/how-to-perform-inner-joins_3.cs b/samples/snippets/csharp/concepts/linq/how-to-perform-inner-joins_3.cs index a8db7c10f726c..0c142c19cdfb5 100644 --- a/samples/snippets/csharp/concepts/linq/how-to-perform-inner-joins_3.cs +++ b/samples/snippets/csharp/concepts/linq/how-to-perform-inner-joins_3.cs @@ -51,15 +51,15 @@ public static void MultipleJoinExample() // with the same letter as the cats that have the same owner. var query = from person in people join cat in cats on person equals cat.Owner - join dog in dogs on + join dog in dogs on new { Owner = person, Letter = cat.Name.Substring(0, 1) } equals new { dog.Owner, Letter = dog.Name.Substring(0, 1) } select new { CatName = cat.Name, DogName = dog.Name }; foreach (var obj in query) { - Console.WriteLine( - $"The cat \"{obj.CatName}\" shares a house, and the first letter of their name, with \"{obj.DogName}\"."); + Console.WriteLine( + $"The cat \"{obj.CatName}\" shares a house, and the first letter of their name, with \"{obj.DogName}\"."); } } diff --git a/samples/snippets/csharp/concepts/linq/how-to-perform-inner-joins_4.cs b/samples/snippets/csharp/concepts/linq/how-to-perform-inner-joins_4.cs index 5e96594a15cb6..8eb680729717e 100644 --- a/samples/snippets/csharp/concepts/linq/how-to-perform-inner-joins_4.cs +++ b/samples/snippets/csharp/concepts/linq/how-to-perform-inner-joins_4.cs @@ -44,7 +44,7 @@ from subpet in gj var query2 = from person in people join pet in pets on person equals pet.Owner select new { OwnerName = person.FirstName, PetName = pet.Name }; - + Console.WriteLine("\nThe equivalent operation using Join():"); foreach (var v in query2) Console.WriteLine($"{v.OwnerName} - {v.PetName}"); diff --git a/samples/snippets/csharp/concepts/linq/how-to-query-a-collection-of-objects_1.cs b/samples/snippets/csharp/concepts/linq/how-to-query-a-collection-of-objects_1.cs index 4069d62c391b0..f1aa305027dbe 100644 --- a/samples/snippets/csharp/concepts/linq/how-to-query-a-collection-of-objects_1.cs +++ b/samples/snippets/csharp/concepts/linq/how-to-query-a-collection-of-objects_1.cs @@ -11,41 +11,41 @@ public enum GradeLevel { FirstYear = 1, SecondYear, ThirdYear, FourthYear }; protected static List students = new List { - new Student {FirstName = "Terry", LastName = "Adams", Id = 120, - Year = GradeLevel.SecondYear, + new Student {FirstName = "Terry", LastName = "Adams", Id = 120, + Year = GradeLevel.SecondYear, ExamScores = new List { 99, 82, 81, 79}}, - new Student {FirstName = "Fadi", LastName = "Fakhouri", Id = 116, + new Student {FirstName = "Fadi", LastName = "Fakhouri", Id = 116, Year = GradeLevel.ThirdYear, ExamScores = new List { 99, 86, 90, 94}}, - new Student {FirstName = "Hanying", LastName = "Feng", Id = 117, - Year = GradeLevel.FirstYear, + new Student {FirstName = "Hanying", LastName = "Feng", Id = 117, + Year = GradeLevel.FirstYear, ExamScores = new List { 93, 92, 80, 87}}, - new Student {FirstName = "Cesar", LastName = "Garcia", Id = 114, + new Student {FirstName = "Cesar", LastName = "Garcia", Id = 114, Year = GradeLevel.FourthYear, ExamScores = new List { 97, 89, 85, 82}}, - new Student {FirstName = "Debra", LastName = "Garcia", Id = 115, - Year = GradeLevel.ThirdYear, + new Student {FirstName = "Debra", LastName = "Garcia", Id = 115, + Year = GradeLevel.ThirdYear, ExamScores = new List { 35, 72, 91, 70}}, - new Student {FirstName = "Hugo", LastName = "Garcia", Id = 118, - Year = GradeLevel.SecondYear, + new Student {FirstName = "Hugo", LastName = "Garcia", Id = 118, + Year = GradeLevel.SecondYear, ExamScores = new List { 92, 90, 83, 78}}, - new Student {FirstName = "Sven", LastName = "Mortensen", Id = 113, - Year = GradeLevel.FirstYear, + new Student {FirstName = "Sven", LastName = "Mortensen", Id = 113, + Year = GradeLevel.FirstYear, ExamScores = new List { 88, 94, 65, 91}}, - new Student {FirstName = "Claire", LastName = "O'Donnell", Id = 112, - Year = GradeLevel.FourthYear, + new Student {FirstName = "Claire", LastName = "O'Donnell", Id = 112, + Year = GradeLevel.FourthYear, ExamScores = new List { 75, 84, 91, 39}}, - new Student {FirstName = "Svetlana", LastName = "Omelchenko", Id = 111, - Year = GradeLevel.SecondYear, + new Student {FirstName = "Svetlana", LastName = "Omelchenko", Id = 111, + Year = GradeLevel.SecondYear, ExamScores = new List { 97, 92, 81, 60}}, - new Student {FirstName = "Lance", LastName = "Tucker", Id = 119, - Year = GradeLevel.ThirdYear, + new Student {FirstName = "Lance", LastName = "Tucker", Id = 119, + Year = GradeLevel.ThirdYear, ExamScores = new List { 68, 79, 88, 92}}, - new Student {FirstName = "Michael", LastName = "Tucker", Id = 122, - Year = GradeLevel.FirstYear, + new Student {FirstName = "Michael", LastName = "Tucker", Id = 122, + Year = GradeLevel.FirstYear, ExamScores = new List { 94, 92, 91, 91}}, new Student {FirstName = "Eugene", LastName = "Zabokritski", Id = 121, - Year = GradeLevel.FourthYear, + Year = GradeLevel.FourthYear, ExamScores = new List { 96, 85, 91, 60}} }; #endregion diff --git a/samples/snippets/csharp/concepts/linq/how-to-return-a-query-from-a-method_1.cs b/samples/snippets/csharp/concepts/linq/how-to-return-a-query-from-a-method_1.cs index bfe6626503c3d..75cb6eab4da09 100644 --- a/samples/snippets/csharp/concepts/linq/how-to-return-a-query-from-a-method_1.cs +++ b/samples/snippets/csharp/concepts/linq/how-to-return-a-query-from-a-method_1.cs @@ -35,7 +35,7 @@ static void Main() Console.WriteLine(s); } - // You also can execute the query returned from QueryMethod1 + // You also can execute the query returned from QueryMethod1 // directly, without using myQuery1. Console.WriteLine("\nResults of executing myQuery1 directly:"); // Rest the mouse pointer over the call to QueryMethod1 to see its @@ -74,4 +74,4 @@ orderby item descending Console.WriteLine("Press any key to exit."); Console.ReadKey(); } - } \ No newline at end of file + } \ No newline at end of file diff --git a/samples/snippets/csharp/concepts/linq/index_1.cs b/samples/snippets/csharp/concepts/linq/index_1.cs index 9a2f668a7ac5b..c1d9310c2d6e1 100644 --- a/samples/snippets/csharp/concepts/linq/index_1.cs +++ b/samples/snippets/csharp/concepts/linq/index_1.cs @@ -2,7 +2,7 @@ { static void Main() { - + // Specify the data source. int[] scores = new int[] { 97, 92, 81, 60 }; @@ -16,7 +16,7 @@ where score > 80 foreach (int i in scoreQuery) { Console.Write(i + " "); - } + } } } // Output: 97 92 81 \ No newline at end of file diff --git a/samples/snippets/csharp/concepts/linq/query-expression-basics_5.cs b/samples/snippets/csharp/concepts/linq/query-expression-basics_5.cs index 5ca36549bcea0..34ea17b11d20e 100644 --- a/samples/snippets/csharp/concepts/linq/query-expression-basics_5.cs +++ b/samples/snippets/csharp/concepts/linq/query-expression-basics_5.cs @@ -14,6 +14,6 @@ orderby score descending // optional foreach (int testScore in scoreQuery) { Console.WriteLine(testScore); - } + } } - // Outputs: 93 90 82 82 \ No newline at end of file + // Outputs: 93 90 82 82 \ No newline at end of file diff --git a/samples/snippets/csharp/concepts/linq/query-expression-basics_8.cs b/samples/snippets/csharp/concepts/linq/query-expression-basics_8.cs index 0482ba17d1015..563ffcf7a6790 100644 --- a/samples/snippets/csharp/concepts/linq/query-expression-basics_8.cs +++ b/samples/snippets/csharp/concepts/linq/query-expression-basics_8.cs @@ -1,5 +1,5 @@  // Use of var is optional here and in all queries. - // queryCities is an IEnumerable just as + // queryCities is an IEnumerable just as // when it is explicitly typed. var queryCities = from city in cities diff --git a/samples/snippets/csharp/concepts/methods/async1.cs b/samples/snippets/csharp/concepts/methods/async1.cs index 721a25840cbf4..bdc69d60551c9 100644 --- a/samples/snippets/csharp/concepts/methods/async1.cs +++ b/samples/snippets/csharp/concepts/methods/async1.cs @@ -28,4 +28,4 @@ private static async Task DelayAsync() } // The example displays the following output: // Result: 5 -// +// diff --git a/samples/snippets/csharp/concepts/methods/byref108.cs b/samples/snippets/csharp/concepts/methods/byref108.cs index 60fc4d862321c..b947cc951e52a 100644 --- a/samples/snippets/csharp/concepts/methods/byref108.cs +++ b/samples/snippets/csharp/concepts/methods/byref108.cs @@ -1,9 +1,9 @@ // using System; -class Example +class Example { - static void Main() + static void Main() { int[] arr = {1, 4, 5}; Console.WriteLine("In Main, array has {0} elements and starts with {1}", diff --git a/samples/snippets/csharp/concepts/methods/byvalue42.cs b/samples/snippets/csharp/concepts/methods/byvalue42.cs index 6ba4851c5b2bb..f9f8d5d64add7 100644 --- a/samples/snippets/csharp/concepts/methods/byvalue42.cs +++ b/samples/snippets/csharp/concepts/methods/byvalue42.cs @@ -15,7 +15,7 @@ public static void Main() ModifyObject(rt); Console.WriteLine(rt.value); } - + static void ModifyObject(SampleRefType obj) { obj.value = 33; diff --git a/samples/snippets/csharp/concepts/methods/methods40.cs b/samples/snippets/csharp/concepts/methods/methods40.cs index 6f661d52fefde..9393314bf5521 100644 --- a/samples/snippets/csharp/concepts/methods/methods40.cs +++ b/samples/snippets/csharp/concepts/methods/methods40.cs @@ -16,7 +16,7 @@ protected void AddGas(int gallons) { /* Method statements here */ } public virtual int Drive(TimeSpan time, int speed) { /* Method statements here */ return 0; } // Derived classes must implement this. - public abstract double GetTopSpeed(); + public abstract double GetTopSpeed(); } // @@ -31,14 +31,14 @@ public override double GetTopSpeed() static void Main() { - + TestMotorcycle moto = new TestMotorcycle(); moto.StartEngine(); moto.AddGas(15); moto.Drive(5, 20); double speed = moto.GetTopSpeed(); - Console.WriteLine("My top speed is {0}", speed); + Console.WriteLine("My top speed is {0}", speed); } } // diff --git a/samples/snippets/csharp/concepts/methods/named1.cs b/samples/snippets/csharp/concepts/methods/named1.cs index 9dbdd043867eb..4c44a289e93ad 100644 --- a/samples/snippets/csharp/concepts/methods/named1.cs +++ b/samples/snippets/csharp/concepts/methods/named1.cs @@ -15,12 +15,12 @@ public override double GetTopSpeed() static void Main() { - + TestMotorcycle moto = new TestMotorcycle(); moto.StartEngine(); moto.AddGas(15); var travelTime = moto.Drive(speed: 60, miles: 170); - Console.WriteLine("Travel time: approx. {0} hours", travelTime); + Console.WriteLine("Travel time: approx. {0} hours", travelTime); } } // The example displays the following output: @@ -42,5 +42,5 @@ protected void AddGas(int gallons) { /* Method statements here */ } public virtual int Drive(TimeSpan time, int speed) { /* Method statements here */ return 0; } // Derived classes must implement this. - public abstract double GetTopSpeed(); + public abstract double GetTopSpeed(); } diff --git a/samples/snippets/csharp/concepts/methods/named2.cs b/samples/snippets/csharp/concepts/methods/named2.cs index de47ed966a82e..d14f3b4de595f 100644 --- a/samples/snippets/csharp/concepts/methods/named2.cs +++ b/samples/snippets/csharp/concepts/methods/named2.cs @@ -14,14 +14,14 @@ public override double GetTopSpeed() static void Main() { - + TestMotorcycle moto = new TestMotorcycle(); moto.StartEngine(); moto.AddGas(15); // var travelTime = moto.Drive(170, speed: 55); // - Console.WriteLine("Travel time: approx. {0} hours", travelTime); + Console.WriteLine("Travel time: approx. {0} hours", travelTime); } } @@ -40,5 +40,5 @@ protected void AddGas(int gallons) { /* Method statements here */ } public virtual int Drive(TimeSpan time, int speed) { /* Method statements here */ return 0; } // Derived classes must implement this. - public abstract double GetTopSpeed(); + public abstract double GetTopSpeed(); } diff --git a/samples/snippets/csharp/concepts/methods/optional1.cs b/samples/snippets/csharp/concepts/methods/optional1.cs index 4eb769e7d0a19..b281f5b6b3cd9 100644 --- a/samples/snippets/csharp/concepts/methods/optional1.cs +++ b/samples/snippets/csharp/concepts/methods/optional1.cs @@ -6,7 +6,7 @@ public class Options public void ExampleMethod(int required, int optionalInt = default(int), string description = "Optional Description") { - Console.WriteLine("{0}: {1} + {2} = {3}", description, required, + Console.WriteLine("{0}: {1} + {2} = {3}", description, required, optionalInt, required + optionalInt); } } @@ -22,7 +22,7 @@ public static void Main() opt.ExampleMethod(10, 2); opt.ExampleMethod(12, description: "Addition with zero:"); } -} +} // The example displays the following output: // Optional Description: 10 + 0 = 10 // Optional Description: 10 + 2 = 12 diff --git a/samples/snippets/csharp/concepts/methods/overridden1.cs b/samples/snippets/csharp/concepts/methods/overridden1.cs index 7994da00b90f0..6e68cdb9c99af 100644 --- a/samples/snippets/csharp/concepts/methods/overridden1.cs +++ b/samples/snippets/csharp/concepts/methods/overridden1.cs @@ -7,7 +7,7 @@ public class Person public override bool Equals(object obj) { - var p2 = obj as Person; + var p2 = obj as Person; if (p2 == null) return false; else @@ -17,7 +17,7 @@ public override bool Equals(object obj) public override int GetHashCode() { return FirstName.GetHashCode(); - } + } } public class Example diff --git a/samples/snippets/csharp/concepts/methods/params74.cs b/samples/snippets/csharp/concepts/methods/params74.cs index 97efec547e80e..3c0b7e0ff8cf6 100644 --- a/samples/snippets/csharp/concepts/methods/params74.cs +++ b/samples/snippets/csharp/concepts/methods/params74.cs @@ -13,7 +13,7 @@ public static void Main() // Call with an expression that evaluates to int. int productC = Square(productA * 3); } - + static int Square(int i) { // Store input argument in a local variable. diff --git a/samples/snippets/csharp/concepts/methods/returnarray1.cs b/samples/snippets/csharp/concepts/methods/returnarray1.cs index a296672da3e7a..8fdbc14a05030 100644 --- a/samples/snippets/csharp/concepts/methods/returnarray1.cs +++ b/samples/snippets/csharp/concepts/methods/returnarray1.cs @@ -4,14 +4,14 @@ public class Example { - static void Main(string[] args) - { + static void Main(string[] args) + { int[] values = { 2, 4, 6, 8 }; DoubleValues(values); foreach (var value in values) Console.Write("{0} ", value); - } - + } + public static void DoubleValues(int[] arr) { for (int ctr = 0; ctr <= arr.GetUpperBound(0); ctr++) diff --git a/samples/snippets/csharp/concepts/methods/swap107.cs b/samples/snippets/csharp/concepts/methods/swap107.cs index 7d02df11eb682..98023fb98e560 100644 --- a/samples/snippets/csharp/concepts/methods/swap107.cs +++ b/samples/snippets/csharp/concepts/methods/swap107.cs @@ -18,7 +18,7 @@ static void Swap(ref int x, ref int y) int temp = x; x = y; y = temp; - } + } } // The example displays the following output: // i = 2 j = 3 diff --git a/samples/snippets/csharp/delegates-and-events/FileLogger.cs b/samples/snippets/csharp/delegates-and-events/FileLogger.cs index 0e0082925cf70..42fdbece740b5 100644 --- a/samples/snippets/csharp/delegates-and-events/FileLogger.cs +++ b/samples/snippets/csharp/delegates-and-events/FileLogger.cs @@ -27,8 +27,8 @@ private void LogMessage(string msg) } catch (Exception) { - // Hmm. We caught an exception while - // logging. We can't really log the + // Hmm. We caught an exception while + // logging. We can't really log the // problem (since it's the log that's failing). // So, while normally, catching an exception // and doing nothing isn't wise, it's really the diff --git a/samples/snippets/csharp/delegates-and-events/Logger.cs b/samples/snippets/csharp/delegates-and-events/Logger.cs index a3c7c121788ce..2ad203ee31554 100644 --- a/samples/snippets/csharp/delegates-and-events/Logger.cs +++ b/samples/snippets/csharp/delegates-and-events/Logger.cs @@ -2,7 +2,7 @@ namespace DelegatesAndEvents { - + // Logger implementation two // public enum Severity @@ -20,14 +20,14 @@ public enum Severity public static class Logger { public static Action WriteMessage; - + public static Severity LogLevel {get;set;} = Severity.Warning; - + public static void LogMessage(Severity s, string component, string msg) { if (s < LogLevel) return; - + var outputMsg = $"{DateTime.Now}\t{s}\t{component}\t{msg}"; WriteMessage(outputMsg); } diff --git a/samples/snippets/csharp/delegates-and-events/Program.cs b/samples/snippets/csharp/delegates-and-events/Program.cs index 9677fd465a4f8..1747abf2e9afd 100644 --- a/samples/snippets/csharp/delegates-and-events/Program.cs +++ b/samples/snippets/csharp/delegates-and-events/Program.cs @@ -12,9 +12,9 @@ public static void Main(string[] args) // var file = new FileLogger("log.txt"); // - + Logger.LogMessage(Severity.Warning, "Console", "This is a warning message"); - + Logger.LogMessage(Severity.Information, "Console", "Information message one"); Logger.LogLevel = Severity.Information; diff --git a/samples/snippets/csharp/framework/migration-guide/versions-installed1.cs b/samples/snippets/csharp/framework/migration-guide/versions-installed1.cs index 12aeeac0aaab5..d89973417b0e3 100644 --- a/samples/snippets/csharp/framework/migration-guide/versions-installed1.cs +++ b/samples/snippets/csharp/framework/migration-guide/versions-installed1.cs @@ -7,11 +7,11 @@ public static void Main() { GetVersionFromRegistry(); } - + private static void GetVersionFromRegistry() { // Opens the registry key for the .NET Framework entry. - using (RegistryKey ndpKey = + using (RegistryKey ndpKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32). OpenSubKey(@"SOFTWARE\Microsoft\NET Framework Setup\NDP\")) { @@ -55,7 +55,7 @@ private static void GetVersionFromRegistry() name = (string)subKey.GetValue("Version", ""); if (! string.IsNullOrEmpty(name)) sp = subKey.GetValue("SP", "").ToString(); - + install = subKey.GetValue("Install", "").ToString(); if (string.IsNullOrEmpty(install)) //No install info; it must be later. { diff --git a/samples/snippets/csharp/framework/migration-guide/versions-installed3.cs b/samples/snippets/csharp/framework/migration-guide/versions-installed3.cs index bcf44fae1882f..1564721e341f5 100644 --- a/samples/snippets/csharp/framework/migration-guide/versions-installed3.cs +++ b/samples/snippets/csharp/framework/migration-guide/versions-installed3.cs @@ -19,9 +19,9 @@ private static void Get45PlusFromRegistry() } else { Console.WriteLine(".NET Framework Version 4.5 or later is not detected."); - } + } } - + // Checking the version using >= enables forward compatibility. string CheckFor45PlusVersion(int releaseKey) { @@ -36,20 +36,20 @@ string CheckFor45PlusVersion(int releaseKey) if (releaseKey >= 394802) return "4.6.2"; if (releaseKey >= 394254) - return "4.6.1"; + return "4.6.1"; if (releaseKey >= 393295) - return "4.6"; + return "4.6"; if (releaseKey >= 379893) - return "4.5.2"; + return "4.5.2"; if (releaseKey >= 378675) - return "4.5.1"; + return "4.5.1"; if (releaseKey >= 378389) - return "4.5"; + return "4.5"; // This code should never execute. A non-null release key should mean // that 4.5 or later is installed. return "No 4.5 or later version detected"; } } -} +} // This example displays output like the following: // .NET Framework Version: 4.6.1 diff --git a/samples/snippets/csharp/getting-started/console-linq/Program.cs b/samples/snippets/csharp/getting-started/console-linq/Program.cs index c853b072892d5..ff9bac74a972f 100644 --- a/samples/snippets/csharp/getting-started/console-linq/Program.cs +++ b/samples/snippets/csharp/getting-started/console-linq/Program.cs @@ -13,7 +13,7 @@ public enum Suit Spades } #endregion - + #region snippet3 public enum Rank { diff --git a/samples/snippets/csharp/getting-started/console-linq/extensions.cs b/samples/snippets/csharp/getting-started/console-linq/extensions.cs index bd6f5d1f1ff25..6cb695b3a3f80 100644 --- a/samples/snippets/csharp/getting-started/console-linq/extensions.cs +++ b/samples/snippets/csharp/getting-started/console-linq/extensions.cs @@ -19,7 +19,7 @@ public static IEnumerable InterleaveSequenceWith } } #endregion - + #region snippet2 public static bool SequenceEquals (this IEnumerable first, IEnumerable second) @@ -38,7 +38,7 @@ public static bool SequenceEquals return true; } #endregion - + #region snippet3 public static IEnumerable LogQuery (this IEnumerable sequence, string tag) diff --git a/samples/snippets/csharp/getting-started/console-linq/playingcard.cs b/samples/snippets/csharp/getting-started/console-linq/playingcard.cs index 35b5c9988ac46..033c0259ac39b 100644 --- a/samples/snippets/csharp/getting-started/console-linq/playingcard.cs +++ b/samples/snippets/csharp/getting-started/console-linq/playingcard.cs @@ -5,13 +5,13 @@ public class PlayingCard { public Suit CardSuit { get; } public Rank CardRank { get; } - + public PlayingCard(Suit s, Rank r) { CardSuit = s; CardRank = r; } - + public override string ToString() { return $"{CardRank} of {CardSuit}"; diff --git a/samples/snippets/csharp/getting-started/console-teleprompter/Program.cs b/samples/snippets/csharp/getting-started/console-teleprompter/Program.cs index e1791f1ae7ad2..11a58317996fd 100644 --- a/samples/snippets/csharp/getting-started/console-teleprompter/Program.cs +++ b/samples/snippets/csharp/getting-started/console-teleprompter/Program.cs @@ -70,7 +70,7 @@ static IEnumerable ReadFrom(string file) lineLength = 0; } } - yield return Environment.NewLine; + yield return Environment.NewLine; } } } diff --git a/samples/snippets/csharp/getting-started/console-webapiclient/Repository.cs b/samples/snippets/csharp/getting-started/console-webapiclient/Repository.cs index e5b7079bc60fe..f49191ba6797f 100644 --- a/samples/snippets/csharp/getting-started/console-webapiclient/Repository.cs +++ b/samples/snippets/csharp/getting-started/console-webapiclient/Repository.cs @@ -23,7 +23,7 @@ public class Repository [JsonPropertyName("pushed_at")] public string JsonDate { get; set; } - + public DateTime LastPush => DateTime.ParseExact(JsonDate, "yyyy-MM-ddTHH:mm:ssZ", CultureInfo.InvariantCulture); } diff --git a/samples/snippets/csharp/getting_started/ClassLibraryProjects/ShowCase/Program.cs b/samples/snippets/csharp/getting_started/ClassLibraryProjects/ShowCase/Program.cs index 6202478e602bf..9a04d0eaa3fce 100644 --- a/samples/snippets/csharp/getting_started/ClassLibraryProjects/ShowCase/Program.cs +++ b/samples/snippets/csharp/getting_started/ClassLibraryProjects/ShowCase/Program.cs @@ -5,7 +5,7 @@ class Program { static void Main(string[] args) { - int row = 0; + int row = 0; do { @@ -16,7 +16,7 @@ static void Main(string[] args) if (String.IsNullOrEmpty(input)) break; Console.WriteLine($"Input: {input} {"Begins with uppercase? ",30}: " + input.StartsWithUpper() ? "Yes\n" : "No\n"; - row += 3; + row += 3; } while (true); return; @@ -27,10 +27,10 @@ void ResetConsole() { Console.WriteLine("Press any key to continue..."); Console.ReadKey(); - } + } Console.Clear(); Console.WriteLine("\nPress only to exit; otherwise, enter a string and press :\n"); - row = 3; + row = 3; } } } diff --git a/samples/snippets/csharp/getting_started/with_visual_studio_2017/showcase.cs b/samples/snippets/csharp/getting_started/with_visual_studio_2017/showcase.cs index 2e34f64bdc218..ef27b4abaee40 100644 --- a/samples/snippets/csharp/getting_started/with_visual_studio_2017/showcase.cs +++ b/samples/snippets/csharp/getting_started/with_visual_studio_2017/showcase.cs @@ -5,7 +5,7 @@ class Program { static void Main(string[] args) { - int row = 0; + int row = 0; do { @@ -16,7 +16,7 @@ static void Main(string[] args) if (String.IsNullOrEmpty(input)) break; Console.WriteLine($"Input: {input} {"Begins with uppercase? ",30}: " + $"{(input.StartsWithUpper() ? "Yes" : "No")}\n"); - row += 3; + row += 3; } while (true); return; @@ -26,10 +26,10 @@ void ResetConsole() if (row > 0) { Console.WriteLine("Press any key to continue..."); Console.ReadKey(); - } + } Console.Clear(); Console.WriteLine("\nPress only to exit; otherwise, enter a string and press :\n"); - row = 3; + row = 3; } } } diff --git a/samples/snippets/csharp/how-to/safelycast/asandis/Program.cs b/samples/snippets/csharp/how-to/safelycast/asandis/Program.cs index ebd4c1e0ab0e1..a7faba830ce90 100644 --- a/samples/snippets/csharp/how-to/safelycast/asandis/Program.cs +++ b/samples/snippets/csharp/how-to/safelycast/asandis/Program.cs @@ -35,7 +35,7 @@ static void Main(string[] args) UseAsOperator(sn); // Use the as operator with a value type. - // Note the implicit conversion to int? in + // Note the implicit conversion to int? in // the method body. int i = 5; UseAsWithNullable(i); diff --git a/samples/snippets/csharp/how-to/strings/CompareStrings.cs b/samples/snippets/csharp/how-to/strings/CompareStrings.cs index 26a247ab7ddd5..3a6ee0b9c21ed 100644 --- a/samples/snippets/csharp/how-to/strings/CompareStrings.cs +++ b/samples/snippets/csharp/how-to/strings/CompareStrings.cs @@ -34,7 +34,7 @@ private static void OrdinalDefaultComparisons() result = root.Equals(root2, StringComparison.Ordinal); Console.WriteLine($"Ordinal comparison: <{root}> and <{root2}> are {(result ? "equal." : "not equal.")}"); - Console.WriteLine($"Using == says that <{root}> and <{root2}> are {(root == root2 ? "equal" : "not equal")}"); + Console.WriteLine($"Using == says that <{root}> and <{root2}> are {(root == root2 ? "equal" : "not equal")}"); // } @@ -61,7 +61,7 @@ private static void OrdinalIgnoreCaseComparisons() private static void WordSortOrderInvariantCulture() { - // + // string first = "Sie tanzen auf der Straße."; string second = "Sie tanzen auf der Strasse."; @@ -100,7 +100,7 @@ void showComparison(string one, string two) } private static void LinguisticComparisons() { - // + // string first = "Sie tanzen auf der Straße."; string second = "Sie tanzen auf der Strasse."; @@ -109,7 +109,7 @@ private static void LinguisticComparisons() var en = new System.Globalization.CultureInfo("en-US"); - // For culture-sensitive comparisons, use the String.Compare + // For culture-sensitive comparisons, use the String.Compare // overload that takes a StringComparison value. int i = String.Compare(first, second, en, System.Globalization.CompareOptions.None); Console.WriteLine($"Comparing in {en.Name} returns {i}."); @@ -241,7 +241,7 @@ private static void SortListOfStrings() Console.WriteLine("\n\rSorted order:"); - lines.Sort((left, right) => left.CompareTo(right)); + lines.Sort((left, right) => left.CompareTo(right)); foreach (string s in lines) { Console.WriteLine($" {s}"); diff --git a/samples/snippets/csharp/how-to/strings/ModifyStrings.cs b/samples/snippets/csharp/how-to/strings/ModifyStrings.cs index 602509c0d5502..a2e3a9be13d90 100644 --- a/samples/snippets/csharp/how-to/strings/ModifyStrings.cs +++ b/samples/snippets/csharp/how-to/strings/ModifyStrings.cs @@ -82,11 +82,11 @@ private static void ReplaceWithRegEx() // string source = "The mountains are still there behind the clouds today."; - // Use Regex.Replace for more flexibility. + // Use Regex.Replace for more flexibility. // Replace "the" or "The" with "many" or "Many". // using System.Text.RegularExpressions string replaceWith = "many "; - source = System.Text.RegularExpressions.Regex.Replace(source, "the\\s", LocalReplaceMatchCase, + source = System.Text.RegularExpressions.Regex.Replace(source, "the\\s", LocalReplaceMatchCase, System.Text.RegularExpressions.RegexOptions.IgnoreCase); Console.WriteLine(source); @@ -143,7 +143,7 @@ private static void UsingStringCreate() strContent[i + 2] = charArray[i]; } }); - + Console.WriteLine(result); // } diff --git a/samples/snippets/csharp/how-to/strings/ParseStringsUsingSplit.cs b/samples/snippets/csharp/how-to/strings/ParseStringsUsingSplit.cs index 4d3175da8d24a..d4d400ea6e5d9 100644 --- a/samples/snippets/csharp/how-to/strings/ParseStringsUsingSplit.cs +++ b/samples/snippets/csharp/how-to/strings/ParseStringsUsingSplit.cs @@ -71,7 +71,7 @@ private static void SplitOnMultipleChars() } // } - + private static void SplitOnMultipleCharsWithGaps() { // diff --git a/samples/snippets/csharp/how-to/strings/SearchStrings.cs b/samples/snippets/csharp/how-to/strings/SearchStrings.cs index 87f2d7d677d75..fb6b7637da9f0 100644 --- a/samples/snippets/csharp/how-to/strings/SearchStrings.cs +++ b/samples/snippets/csharp/how-to/strings/SearchStrings.cs @@ -26,7 +26,7 @@ private static void SearchWithMethods() bool containsSearchResult = factMessage.Contains("extension"); Console.WriteLine($"Starts with \"extension\"? {containsSearchResult}"); - // For user input and strings that will be displayed to the end user, + // For user input and strings that will be displayed to the end user, // use the StringComparison parameter on methods that have it to specify how to match strings. bool ignoreCaseSearchResult = factMessage.StartsWith("extension", System.StringComparison.CurrentCultureIgnoreCase); Console.WriteLine($"Starts with \"extension\"? {ignoreCaseSearchResult} (ignoring case)"); @@ -44,7 +44,7 @@ private static void SearchByIndex() // Write the string and include the quotation marks. Console.WriteLine($"\"{factMessage}\""); - // This search returns the substring between two strings, so + // This search returns the substring between two strings, so // the first index is moved to the character just after the first string. int first = factMessage.IndexOf("methods") + "methods".Length; int last = factMessage.LastIndexOf("methods"); diff --git a/samples/snippets/csharp/interfaces/ExplicitImplementation.cs b/samples/snippets/csharp/interfaces/ExplicitImplementation.cs index 6cf9feee8e7f7..84ba68ce911d9 100644 --- a/samples/snippets/csharp/interfaces/ExplicitImplementation.cs +++ b/samples/snippets/csharp/interfaces/ExplicitImplementation.cs @@ -2,7 +2,7 @@ namespace interfaces { - public class InterfaceSnippets + public class InterfaceSnippets { public static void TestInterfaces() { @@ -24,7 +24,7 @@ public interface ISurface } public class SampleClass : IControl, ISurface { - // Both ISurface.Paint and IControl.Paint call this method. + // Both ISurface.Paint and IControl.Paint call this method. public void Paint() { Console.WriteLine("Paint method in SampleClass"); diff --git a/samples/snippets/csharp/interfaces/properties.cs b/samples/snippets/csharp/interfaces/properties.cs index 7ae55d2f083a3..276ebe2e764ec 100644 --- a/samples/snippets/csharp/interfaces/properties.cs +++ b/samples/snippets/csharp/interfaces/properties.cs @@ -65,7 +65,7 @@ public class Employee : IEmployee private string _name; public string Name // read-write instance property { - get => _name; + get => _name; set => _name = value; } @@ -76,7 +76,7 @@ public int Counter // read-only instance property } // constructor - public Employee() => _counter = ++numberOfEmployees; + public Employee() => _counter = ++numberOfEmployees; } // diff --git a/samples/snippets/csharp/keywords/FixedKeywordExamples.cs b/samples/snippets/csharp/keywords/FixedKeywordExamples.cs index 754e30f97b46d..62a47f27a3c25 100644 --- a/samples/snippets/csharp/keywords/FixedKeywordExamples.cs +++ b/samples/snippets/csharp/keywords/FixedKeywordExamples.cs @@ -19,10 +19,10 @@ public static void Examples() } // - class Point - { + class Point + { public int x; - public int y; + public int y; } unsafe private static void ModifyFixedStorage() @@ -80,15 +80,15 @@ unsafe private static void InitializeFixedStorage() // You can initialize a pointer by using an array. fixed (double* p = arr) { /*...*/ } - // You can initialize a pointer by using the address of a variable. + // You can initialize a pointer by using the address of a variable. fixed (double* p = &arr[0]) { /*...*/ } // The following assignment initializes p by using a string. fixed (char* p = str) { /*...*/ } - // The following assignment is not valid, because str[0] is a char, + // The following assignment is not valid, because str[0] is a char, // which is a value, not a variable. - //fixed (char* p = &str[0]) { /*...*/ } + //fixed (char* p = &str[0]) { /*...*/ } // } @@ -240,9 +240,9 @@ static unsafe void Copy(byte[] source, int sourceOffset, byte[] target, throw new System.ArgumentException(); } - // If the number of bytes from the offset to the end of the array is + // If the number of bytes from the offset to the end of the array is // less than the number of bytes you want to copy, you cannot complete - // the copy. + // the copy. if ((source.Length - sourceOffset < count) || (target.Length - targetOffset < count)) { @@ -294,7 +294,7 @@ static void UnsafeCopyArrays() } System.Console.WriteLine("\n"); - // Copy the contents of the last 10 elements of byteArray1 to the + // Copy the contents of the last 10 elements of byteArray1 to the // beginning of byteArray2. // The offset specifies where the copying begins in the source array. int offset = length - 10; diff --git a/samples/snippets/csharp/keywords/IterationKeywordsExamples.cs b/samples/snippets/csharp/keywords/IterationKeywordsExamples.cs index fcc956a309cf7..ba154acbfdbe1 100644 --- a/samples/snippets/csharp/keywords/IterationKeywordsExamples.cs +++ b/samples/snippets/csharp/keywords/IterationKeywordsExamples.cs @@ -69,7 +69,7 @@ private static void DoLoopExample() { // int n = 0; - do + do { Console.WriteLine(n); n++; diff --git a/samples/snippets/csharp/language-reference/keywords/in-ref-out-modifier/InParameterModifier.cs b/samples/snippets/csharp/language-reference/keywords/in-ref-out-modifier/InParameterModifier.cs index 8f2ff0d273165..4a818d6ef8440 100644 --- a/samples/snippets/csharp/language-reference/keywords/in-ref-out-modifier/InParameterModifier.cs +++ b/samples/snippets/csharp/language-reference/keywords/in-ref-out-modifier/InParameterModifier.cs @@ -26,7 +26,7 @@ void InArgExample(in int number) // } } - + // class InOverloadExample { diff --git a/samples/snippets/csharp/language-reference/keywords/in-ref-out-modifier/OutParameterModifier.cs b/samples/snippets/csharp/language-reference/keywords/in-ref-out-modifier/OutParameterModifier.cs index 2c7b8bef0f0ca..3ca034522c350 100644 --- a/samples/snippets/csharp/language-reference/keywords/in-ref-out-modifier/OutParameterModifier.cs +++ b/samples/snippets/csharp/language-reference/keywords/in-ref-out-modifier/OutParameterModifier.cs @@ -43,12 +43,12 @@ void Method(out int answer, out string message, out string stillNull) Console.WriteLine(argNumber); Console.WriteLine(argMessage); Console.WriteLine(argDefault == null); - + // The example displays the following output: // 44 // I've been returned // True - + // } diff --git a/samples/snippets/csharp/language-reference/keywords/in-ref-out-modifier/RefParameterModifier.cs b/samples/snippets/csharp/language-reference/keywords/in-ref-out-modifier/RefParameterModifier.cs index dd6493691e37e..8068e7b5d4bf5 100644 --- a/samples/snippets/csharp/language-reference/keywords/in-ref-out-modifier/RefParameterModifier.cs +++ b/samples/snippets/csharp/language-reference/keywords/in-ref-out-modifier/RefParameterModifier.cs @@ -42,7 +42,7 @@ public Product(string name, int newID) private static void ChangeByReference(ref Product itemRef) { - // Change the address that is stored in the itemRef parameter. + // Change the address that is stored in the itemRef parameter. itemRef = new Product("Stapler", 99999); // You can change the value of one of the properties of @@ -62,11 +62,11 @@ private static void ModifyProductsByReference() System.Console.WriteLine("Back in Main. Name: {0}, ID: {1}\n", item.ItemName, item.ItemID); } - + // This method displays the following output: // Original values in Main. Name: Fasteners, ID: 54321 - // Back in Main. Name: Stapler, ID: 12345 - + // Back in Main. Name: Stapler, ID: 12345 + // private static void BookCollectionExample() @@ -82,7 +82,7 @@ private static void BookCollectionExample() // The example displays the following output: // Call of the Wild, The, by Jack London // Tale of Two Cities, A, by Charles Dickens - // + // // Republic, The, by Plato // Tale of Two Cities, A, by Charles Dickens // diff --git a/samples/snippets/csharp/language-reference/keywords/is/is-const-pattern11.cs b/samples/snippets/csharp/language-reference/keywords/is/is-const-pattern11.cs index 67185a788de4d..bcf4eab07fc6c 100644 --- a/samples/snippets/csharp/language-reference/keywords/is/is-const-pattern11.cs +++ b/samples/snippets/csharp/language-reference/keywords/is/is-const-pattern11.cs @@ -15,7 +15,7 @@ static void Main(string[] args) { Console.WriteLine($"o is {o}"); } - + int? x = 10; if (x is null) @@ -26,7 +26,7 @@ static void Main(string[] args) { Console.WriteLine($"x is {x.Value}"); } - + // 'null' check comparison Console.WriteLine($"'is' constant pattern 'null' check result : { o is null }"); Console.WriteLine($"object.ReferenceEquals 'null' check result : { object.ReferenceEquals(o, null) }"); diff --git a/samples/snippets/csharp/language-reference/keywords/is/is-const-pattern7.cs b/samples/snippets/csharp/language-reference/keywords/is/is-const-pattern7.cs index 6d5c35135b3f8..f30ff1e181d19 100644 --- a/samples/snippets/csharp/language-reference/keywords/is/is-const-pattern7.cs +++ b/samples/snippets/csharp/language-reference/keywords/is/is-const-pattern7.cs @@ -9,7 +9,7 @@ public Dice() } public int Roll() { - return rnd.Next(1, 7); + return rnd.Next(1, 7); } } diff --git a/samples/snippets/csharp/language-reference/keywords/is/is-type-pattern10.cs b/samples/snippets/csharp/language-reference/keywords/is/is-type-pattern10.cs index ac7f717cb6780..eee9d98ff7cdd 100644 --- a/samples/snippets/csharp/language-reference/keywords/is/is-type-pattern10.cs +++ b/samples/snippets/csharp/language-reference/keywords/is/is-type-pattern10.cs @@ -7,7 +7,7 @@ public static void Main() { Object o = new Person("Jane"); ShowValue(o); - + o = new Dog("Alaskan Malamute"); ShowValue(o); } @@ -17,18 +17,18 @@ public static void ShowValue(object o) if (o is Person) { Person p = (Person) o; Console.WriteLine(p.Name); - } + } else if (o is Dog) { Dog d = (Dog) o; Console.WriteLine(d.Breed); - } + } } } public struct Person -{ +{ public string Name { get; set; } - + public Person(string name) : this() { Name = name; diff --git a/samples/snippets/csharp/language-reference/keywords/is/is-type-pattern9.cs b/samples/snippets/csharp/language-reference/keywords/is/is-type-pattern9.cs index ac772c56fe83f..447ba95be80c8 100644 --- a/samples/snippets/csharp/language-reference/keywords/is/is-type-pattern9.cs +++ b/samples/snippets/csharp/language-reference/keywords/is/is-type-pattern9.cs @@ -7,7 +7,7 @@ public static void Main() { Object o = new Person("Jane"); ShowValue(o); - + o = new Dog("Alaskan Malamute"); ShowValue(o); } @@ -16,17 +16,17 @@ public static void ShowValue(object o) { if (o is Person p) { Console.WriteLine(p.Name); - } + } else if (o is Dog d) { Console.WriteLine(d.Breed); - } + } } } public struct Person -{ +{ public string Name { get; set; } - + public Person(string name) : this() { Name = name; diff --git a/samples/snippets/csharp/language-reference/keywords/is/is-var-pattern8.cs b/samples/snippets/csharp/language-reference/keywords/is/is-var-pattern8.cs index 51cd25c0acc3c..9c6b4ccac1389 100644 --- a/samples/snippets/csharp/language-reference/keywords/is/is-var-pattern8.cs +++ b/samples/snippets/csharp/language-reference/keywords/is/is-var-pattern8.cs @@ -20,15 +20,15 @@ static void Main() } } - static IEnumerable Factor(int number) + static IEnumerable Factor(int number) { int max = (int)Math.Sqrt(number); - for (int i = 1; i <= max; i++) + for (int i = 1; i <= max; i++) { if (number % i == 0) { yield return i; - if (i != number / i) + if (i != number / i) { yield return number / i; } diff --git a/samples/snippets/csharp/language-reference/keywords/switch/const-pattern.cs b/samples/snippets/csharp/language-reference/keywords/switch/const-pattern.cs index 42f7129c45fc5..6d213a45d2397 100644 --- a/samples/snippets/csharp/language-reference/keywords/switch/const-pattern.cs +++ b/samples/snippets/csharp/language-reference/keywords/switch/const-pattern.cs @@ -19,7 +19,7 @@ static void Main() break; default: Console.WriteLine("The middle of the work week."); - break; + break; } } } diff --git a/samples/snippets/csharp/language-reference/keywords/switch/switch1.cs b/samples/snippets/csharp/language-reference/keywords/switch/switch1.cs index 99af971af5c3a..0698214cd17bd 100644 --- a/samples/snippets/csharp/language-reference/keywords/switch/switch1.cs +++ b/samples/snippets/csharp/language-reference/keywords/switch/switch1.cs @@ -6,7 +6,7 @@ public class Example public static void Main() { int caseSwitch = 1; - + switch (caseSwitch) { case 1: diff --git a/samples/snippets/csharp/language-reference/keywords/switch/switch2.cs b/samples/snippets/csharp/language-reference/keywords/switch/switch2.cs index ae6780d41738b..1151f0427e86c 100644 --- a/samples/snippets/csharp/language-reference/keywords/switch/switch2.cs +++ b/samples/snippets/csharp/language-reference/keywords/switch/switch2.cs @@ -7,7 +7,7 @@ public static void Main() { Random rnd = new Random(); int caseSwitch = rnd.Next(1,4); - + switch (caseSwitch) { case 1: diff --git a/samples/snippets/csharp/language-reference/keywords/switch/switch3.cs b/samples/snippets/csharp/language-reference/keywords/switch/switch3.cs index 8302b3714c715..5eb3a03b4b63c 100644 --- a/samples/snippets/csharp/language-reference/keywords/switch/switch3.cs +++ b/samples/snippets/csharp/language-reference/keywords/switch/switch3.cs @@ -17,11 +17,11 @@ public static void Main() Console.WriteLine("The color is green"); break; case Color.Blue: - Console.WriteLine("The color is blue"); + Console.WriteLine("The color is blue"); break; default: Console.WriteLine("The color is unknown."); - break; + break; } } } diff --git a/samples/snippets/csharp/language-reference/keywords/switch/switch3a.cs b/samples/snippets/csharp/language-reference/keywords/switch/switch3a.cs index 9822f2581c954..fbe53acefd966 100644 --- a/samples/snippets/csharp/language-reference/keywords/switch/switch3a.cs +++ b/samples/snippets/csharp/language-reference/keywords/switch/switch3a.cs @@ -13,7 +13,7 @@ public static void Main() else if (c == Color.Green) Console.WriteLine("The color is green"); else if (c == Color.Blue) - Console.WriteLine("The color is blue"); + Console.WriteLine("The color is blue"); else Console.WriteLine("The color is unknown."); } diff --git a/samples/snippets/csharp/language-reference/keywords/switch/switch4.cs b/samples/snippets/csharp/language-reference/keywords/switch/switch4.cs index c8e5b08fa8002..354f2e008b9da 100644 --- a/samples/snippets/csharp/language-reference/keywords/switch/switch4.cs +++ b/samples/snippets/csharp/language-reference/keywords/switch/switch4.cs @@ -6,22 +6,22 @@ public static void Main() { int caseSwitch = 1; // - switch (caseSwitch) + switch (caseSwitch) { - case 1: - Console.WriteLine("Case 1..."); - break; - case 2: + case 1: + Console.WriteLine("Case 1..."); + break; + case 2: case 3: - Console.WriteLine("... and/or Case 2"); + Console.WriteLine("... and/or Case 2"); break; - case 4: - while (true) - Console.WriteLine("Endless looping. . . ."); + case 4: + while (true) + Console.WriteLine("Endless looping. . . ."); default: Console.WriteLine("Default value..."); - break; - } + break; + } // } } diff --git a/samples/snippets/csharp/language-reference/keywords/switch/switch5.cs b/samples/snippets/csharp/language-reference/keywords/switch/switch5.cs index a72ed01373ecb..4b4eb65269a0c 100644 --- a/samples/snippets/csharp/language-reference/keywords/switch/switch5.cs +++ b/samples/snippets/csharp/language-reference/keywords/switch/switch5.cs @@ -9,13 +9,13 @@ public static void Main() { var values = new List(); for (int ctr = 0; ctr <= 7; ctr++) { - if (ctr == 2) + if (ctr == 2) values.Add(DiceLibrary.Roll2()); else if (ctr == 4) values.Add(DiceLibrary.Pass()); - else + else values.Add(DiceLibrary.Roll()); - } + } Console.WriteLine($"The sum of { values.Count } die is { DiceLibrary.DiceSum(values) }"); } @@ -35,7 +35,7 @@ public static int Roll() // Roll two dice. public static List Roll2() { - var rolls = new List(); + var rolls = new List(); rolls.Add(Roll()); rolls.Add(Roll()); return rolls; diff --git a/samples/snippets/csharp/language-reference/keywords/switch/type-pattern.cs b/samples/snippets/csharp/language-reference/keywords/switch/type-pattern.cs index ca90783abb0a4..ad76076f90a80 100644 --- a/samples/snippets/csharp/language-reference/keywords/switch/type-pattern.cs +++ b/samples/snippets/csharp/language-reference/keywords/switch/type-pattern.cs @@ -34,7 +34,7 @@ private static void ShowCollectionInformation(object coll) break; case IEnumerable ie: string result = ""; - foreach (var e in ie) + foreach (var e in ie) result += $"{e} "; Console.WriteLine(result); break; diff --git a/samples/snippets/csharp/language-reference/keywords/switch/type-pattern2.cs b/samples/snippets/csharp/language-reference/keywords/switch/type-pattern2.cs index 255174a191f92..eee7463e76ded 100644 --- a/samples/snippets/csharp/language-reference/keywords/switch/type-pattern2.cs +++ b/samples/snippets/csharp/language-reference/keywords/switch/type-pattern2.cs @@ -40,13 +40,13 @@ private static void ShowCollectionInformation(object coll) { IEnumerable ie = (IEnumerable) coll; string result = ""; - foreach (var e in ie) + foreach (var e in ie) result += $"{e} "; Console.WriteLine(result); } else if (coll == null) { - // Do nothing. + // Do nothing. } else { diff --git a/samples/snippets/csharp/language-reference/keywords/switch/type-pattern3.cs b/samples/snippets/csharp/language-reference/keywords/switch/type-pattern3.cs index 6e288b2e0ed2b..aa406b5e8ca78 100644 --- a/samples/snippets/csharp/language-reference/keywords/switch/type-pattern3.cs +++ b/samples/snippets/csharp/language-reference/keywords/switch/type-pattern3.cs @@ -34,7 +34,7 @@ private static void ShowCollectionInformation(T coll) break; case IEnumerable ie: string result = ""; - foreach (var e in ie) + foreach (var e in ie) result += $"{e} "; Console.WriteLine(result); break; diff --git a/samples/snippets/csharp/language-reference/keywords/switch/when-clause.cs b/samples/snippets/csharp/language-reference/keywords/switch/when-clause.cs index 9dd7fe7fd7696..9b3ecb04e539a 100644 --- a/samples/snippets/csharp/language-reference/keywords/switch/when-clause.cs +++ b/samples/snippets/csharp/language-reference/keywords/switch/when-clause.cs @@ -4,26 +4,26 @@ public abstract class Shape { public abstract double Area { get; } - public abstract double Circumference { get; } + public abstract double Circumference { get; } } public class Rectangle : Shape { - public Rectangle(double length, double width) + public Rectangle(double length, double width) { Length = length; - Width = width; + Width = width; } public double Length { get; set; } public double Width { get; set; } - + public override double Area - { - get { return Math.Round(Length * Width,2); } - } - - public override double Circumference + { + get { return Math.Round(Length * Width,2); } + } + + public override double Circumference { get { return (Length + Width) * 2; } } @@ -31,9 +31,9 @@ public override double Circumference public class Square : Rectangle { - public Square(double side) : base(side, side) + public Square(double side) : base(side, side) { - Side = side; + Side = side; } public double Side { get; set; } @@ -41,11 +41,11 @@ public Square(double side) : base(side, side) public class Circle : Shape { - public Circle(double radius) + public Circle(double radius) { Radius = radius; - } - + } + public double Radius { get; set; } public override double Circumference @@ -55,7 +55,7 @@ public override double Circumference public override double Area { - get { return Math.PI * Math.Pow(Radius, 2); } + get { return Math.PI * Math.Pow(Radius, 2); } } } @@ -105,7 +105,7 @@ private static void ShowShapeInfo(Shape sh) break; default: Console.WriteLine($"The {nameof(sh)} variable does not represent a Shape."); - break; + break; } } } diff --git a/samples/snippets/csharp/language-reference/keywords/throw/coalescing.cs b/samples/snippets/csharp/language-reference/keywords/throw/coalescing.cs index 4bb98371f2cf1..c8c7398cbba39 100644 --- a/samples/snippets/csharp/language-reference/keywords/throw/coalescing.cs +++ b/samples/snippets/csharp/language-reference/keywords/throw/coalescing.cs @@ -3,14 +3,14 @@ public class Person { string name; - + // public string Name { get => name; - set => name = value ?? + set => name = value ?? throw new ArgumentNullException(paramName: nameof(value), message: "Name cannot be null"); - } + } // } diff --git a/samples/snippets/csharp/language-reference/keywords/throw/conditional.cs b/samples/snippets/csharp/language-reference/keywords/throw/conditional.cs index 1d440010c25fd..9408b1bcd02f1 100644 --- a/samples/snippets/csharp/language-reference/keywords/throw/conditional.cs +++ b/samples/snippets/csharp/language-reference/keywords/throw/conditional.cs @@ -1,5 +1,5 @@ using System; - + class Program { static void Main(string[] args) @@ -11,16 +11,16 @@ static void Main(string[] args) Console.WriteLine(e.Message); } } - + // private static void DisplayFirstNumber(string[] args) { - string arg = args.Length >= 1 ? args[0] : + string arg = args.Length >= 1 ? args[0] : throw new ArgumentException("You must supply an argument"); if (Int64.TryParse(arg, out var number)) Console.WriteLine($"You entered {number:F0}"); else - Console.WriteLine($"{arg} is not a number."); + Console.WriteLine($"{arg} is not a number."); } -// +// } diff --git a/samples/snippets/csharp/language-reference/keywords/throw/exp-bodied.cs b/samples/snippets/csharp/language-reference/keywords/throw/exp-bodied.cs index 3cd35c04707d4..3f3ff459ea314 100644 --- a/samples/snippets/csharp/language-reference/keywords/throw/exp-bodied.cs +++ b/samples/snippets/csharp/language-reference/keywords/throw/exp-bodied.cs @@ -8,7 +8,7 @@ static void Main(string[] args) } // - DateTime ToDateTime(IFormatProvider provider) => + DateTime ToDateTime(IFormatProvider provider) => throw new InvalidCastException("Conversion to a DateTime is not supported."); // } diff --git a/samples/snippets/csharp/language-reference/keywords/throw/throw-1.cs b/samples/snippets/csharp/language-reference/keywords/throw/throw-1.cs index e8bc498767327..be182ab5004e3 100644 --- a/samples/snippets/csharp/language-reference/keywords/throw/throw-1.cs +++ b/samples/snippets/csharp/language-reference/keywords/throw/throw-1.cs @@ -5,7 +5,7 @@ public class NumberGenerator { int[] numbers = { 2, 4, 6, 8, 10, 12, 14, 16, 18, 20 }; - + public int GetNumber(int index) { if (index < 0 || index >= numbers.Length) { @@ -31,7 +31,7 @@ public static void Main() int value = gen.GetNumber(index); Console.WriteLine($"Retrieved {value}"); } - catch (IndexOutOfRangeException e) + catch (IndexOutOfRangeException e) { Console.WriteLine($"{e.GetType().Name}: {index} is outside the bounds of the array"); } diff --git a/samples/snippets/csharp/language-reference/keywords/throw/throw-3.cs b/samples/snippets/csharp/language-reference/keywords/throw/throw-3.cs index 53916e604ed67..e99d31e246a1d 100644 --- a/samples/snippets/csharp/language-reference/keywords/throw/throw-3.cs +++ b/samples/snippets/csharp/language-reference/keywords/throw/throw-3.cs @@ -16,12 +16,12 @@ public char GetFirstCharacter() return Value[0]; } catch (NullReferenceException e) { - throw; - } + throw; + } } } -public class Example +public class Example { public static void Main() { diff --git a/samples/snippets/csharp/language-reference/keywords/using/using-static1.cs b/samples/snippets/csharp/language-reference/keywords/using/using-static1.cs index db6e79931c5b5..519e95458b99e 100644 --- a/samples/snippets/csharp/language-reference/keywords/using/using-static1.cs +++ b/samples/snippets/csharp/language-reference/keywords/using/using-static1.cs @@ -17,7 +17,7 @@ public double Diameter public double Circumference { - get { return 2 * Radius * Math.PI; } + get { return 2 * Radius * Math.PI; } } public double Area diff --git a/samples/snippets/csharp/language-reference/keywords/using/using-static2.cs b/samples/snippets/csharp/language-reference/keywords/using/using-static2.cs index 060e356ea749e..988cda93565a0 100644 --- a/samples/snippets/csharp/language-reference/keywords/using/using-static2.cs +++ b/samples/snippets/csharp/language-reference/keywords/using/using-static2.cs @@ -18,7 +18,7 @@ public double Diameter public double Circumference { - get { return 2 * Radius * PI; } + get { return 2 * Radius * PI; } } public double Area diff --git a/samples/snippets/csharp/language-reference/keywords/using/using-static3.cs b/samples/snippets/csharp/language-reference/keywords/using/using-static3.cs index 47ba3e8fedbb9..0aae3226a2039 100644 --- a/samples/snippets/csharp/language-reference/keywords/using/using-static3.cs +++ b/samples/snippets/csharp/language-reference/keywords/using/using-static3.cs @@ -11,7 +11,7 @@ static void Main() var input = ReadLine(); if (!IsNullOrEmpty(input) && double.TryParse(input, out var radius)) { var c = new Circle(radius); - + string s = "\nInformation about the circle:\n"; s = s + Format(" Radius: {0:N2}\n", c.Radius); s = s + Format(" Diameter: {0:N2}\n", c.Diameter); @@ -41,7 +41,7 @@ public double Diameter public double Circumference { - get { return 2 * Radius * PI; } + get { return 2 * Radius * PI; } } public double Area @@ -51,7 +51,7 @@ public double Area } // The example displays the following output: // Enter a circle's radius: 12.45 -// +// // Information about the circle: // Radius: 12.45 // Diameter: 24.90 diff --git a/samples/snippets/csharp/language-reference/keywords/verbatim1.cs b/samples/snippets/csharp/language-reference/keywords/verbatim1.cs index a12af1c11e1fd..b3989e8548f6f 100644 --- a/samples/snippets/csharp/language-reference/keywords/verbatim1.cs +++ b/samples/snippets/csharp/language-reference/keywords/verbatim1.cs @@ -18,29 +18,29 @@ public static void Main() // Console.WriteLine(); - + // string filename1 = @"c:\documents\files\u0066.txt"; string filename2 = "c:\\documents\\files\\u0066.txt"; - + Console.WriteLine(filename1); Console.WriteLine(filename2); // The example displays the following output: // c:\documents\files\u0066.txt // c:\documents\files\u0066.txt // - + Console.WriteLine(); - + // string s1 = "He said, \"This is the last \u0063hance\x0021\""; string s2 = @"He said, ""This is the last \u0063hance\x0021"""; - + Console.WriteLine(s1); Console.WriteLine(s2); // The example displays the following output: // He said, "This is the last chance!" - // He said, "This is the last \u0063hance\x0021" + // He said, "This is the last \u0063hance\x0021" // } } diff --git a/samples/snippets/csharp/language-reference/keywords/verbatim2.cs b/samples/snippets/csharp/language-reference/keywords/verbatim2.cs index fb54219b7eecb..d611e2f0b6cf3 100644 --- a/samples/snippets/csharp/language-reference/keywords/verbatim2.cs +++ b/samples/snippets/csharp/language-reference/keywords/verbatim2.cs @@ -5,7 +5,7 @@ public class Info : Attribute { private string information; - + public Info(string info) { information = info; @@ -16,14 +16,14 @@ public Info(string info) public class InfoAttribute : Attribute { private string information; - + public InfoAttribute(string info) { information = info; } } -[Info("A simple executable.")] // Generates compiler error CS1614. Ambiguous Info and InfoAttribute. +[Info("A simple executable.")] // Generates compiler error CS1614. Ambiguous Info and InfoAttribute. // Prepend '@' to select 'Info'. Specify the full name 'InfoAttribute' to select it. public class Example { diff --git a/samples/snippets/csharp/language-reference/keywords/volatile/Program.cs b/samples/snippets/csharp/language-reference/keywords/volatile/Program.cs index 5e373de42e928..01c808006b65f 100644 --- a/samples/snippets/csharp/language-reference/keywords/volatile/Program.cs +++ b/samples/snippets/csharp/language-reference/keywords/volatile/Program.cs @@ -60,7 +60,7 @@ public static void Main() // Request that the worker thread stop itself. workerObject.RequestStop(); - // Use the Thread.Join method to block the current thread + // Use the Thread.Join method to block the current thread // until the object's thread terminates. workerThread.Join(); Console.WriteLine("Main thread: worker thread has terminated."); diff --git a/samples/snippets/csharp/language-reference/keywords/when/catch.cs b/samples/snippets/csharp/language-reference/keywords/when/catch.cs index 09609c5e4523d..1d964b4bd7c97 100644 --- a/samples/snippets/csharp/language-reference/keywords/when/catch.cs +++ b/samples/snippets/csharp/language-reference/keywords/when/catch.cs @@ -10,14 +10,14 @@ static void Main() } public static async Task MakeRequest() - { + { var client = new HttpClient(); var streamTask = client.GetStringAsync("https://localHost:10000"); try { var responseText = await streamTask; return responseText; - } + } catch (HttpRequestException e) when (e.Message.Contains("301")) { return "Site Moved"; diff --git a/samples/snippets/csharp/language-reference/keywords/when/when.cs b/samples/snippets/csharp/language-reference/keywords/when/when.cs index 58dfd6552a5ca..fdc1dfdfcaa02 100644 --- a/samples/snippets/csharp/language-reference/keywords/when/when.cs +++ b/samples/snippets/csharp/language-reference/keywords/when/when.cs @@ -4,26 +4,26 @@ public abstract class Shape { public abstract double Area { get; } - public abstract double Circumference { get; } + public abstract double Circumference { get; } } public class Rectangle : Shape { - public Rectangle(double length, double width) + public Rectangle(double length, double width) { Length = length; - Width = width; + Width = width; } public double Length { get; set; } public double Width { get; set; } - + public override double Area - { - get { return Math.Round(Length * Width,2); } - } - - public override double Circumference + { + get { return Math.Round(Length * Width,2); } + } + + public override double Circumference { get { return (Length + Width) * 2; } } @@ -31,9 +31,9 @@ public override double Circumference public class Square : Rectangle { - public Square(double side) : base(side, side) + public Square(double side) : base(side, side) { - Side = side; + Side = side; } public double Side { get; set; } @@ -75,7 +75,7 @@ private static void ShowShapeInfo(Object obj) break; default: Console.WriteLine($"The {nameof(obj)} variable does not represent a Shape."); - break; + break; } } } diff --git a/samples/snippets/csharp/language-reference/tokens/string-interpolation.cs b/samples/snippets/csharp/language-reference/tokens/string-interpolation.cs index 25c7d1a0a4a3a..cf89824341bbc 100644 --- a/samples/snippets/csharp/language-reference/tokens/string-interpolation.cs +++ b/samples/snippets/csharp/language-reference/tokens/string-interpolation.cs @@ -19,7 +19,7 @@ private static void CompareWithCompositeFormatting() // string name = "Mark"; var date = DateTime.Now; - + // Composite formatting: Console.WriteLine("Hello, {0}! Today is {1}, it's {2:HH:mm} now.", name, date.DayOfWeek, date); // String interpolation: @@ -40,7 +40,7 @@ private static void AlignAndSpecifyFormat() // Expected output is: // |Left | Right| // 3.14159265358979 - default formatting of the pi number - // 3.142 - display only three decimal digits of the pi number + // 3.142 - display only three decimal digits of the pi number // } @@ -62,7 +62,7 @@ private static void CreateCultureSpecificResults() // double speedOfLight = 299792.458; FormattableString message = $"The speed of light is {speedOfLight:N3} km/s."; - + System.Globalization.CultureInfo.CurrentCulture = System.Globalization.CultureInfo.GetCultureInfo("nl-NL"); string messageInCurrentCulture = message.ToString(); diff --git a/samples/snippets/csharp/misc/cs4009-1.cs b/samples/snippets/csharp/misc/cs4009-1.cs index c6a7e7fd93f52..793b64542be1f 100644 --- a/samples/snippets/csharp/misc/cs4009-1.cs +++ b/samples/snippets/csharp/misc/cs4009-1.cs @@ -14,7 +14,7 @@ private static async Task WaitTwoSeconds() { await Task.Delay(2000); Console.WriteLine("Returning from an asynchronous method"); - } + } } // The example displays the following output: // About to wait two seconds diff --git a/samples/snippets/csharp/misc/cs4009-2.cs b/samples/snippets/csharp/misc/cs4009-2.cs index 862d199b89c42..98a8e66746f84 100644 --- a/samples/snippets/csharp/misc/cs4009-2.cs +++ b/samples/snippets/csharp/misc/cs4009-2.cs @@ -14,7 +14,7 @@ private static async Task WaitTwoSeconds() { await Task.Delay(2000); Console.WriteLine("Returning from an asynchronous method"); - } + } } // The example displays the following output: // About to wait two seconds diff --git a/samples/snippets/csharp/misc/cs4009-3.cs b/samples/snippets/csharp/misc/cs4009-3.cs index be989dcbbf25b..d3fb6ba035f9e 100644 --- a/samples/snippets/csharp/misc/cs4009-3.cs +++ b/samples/snippets/csharp/misc/cs4009-3.cs @@ -16,7 +16,7 @@ private static async Task WaitTwoSeconds() await Task.Delay(2000); Console.WriteLine("Returning from an asynchronous method"); return 100; - } + } } // The example displays the following output: // About to wait two seconds diff --git a/samples/snippets/csharp/new-in-6/NetworkClient.cs b/samples/snippets/csharp/new-in-6/NetworkClient.cs index cc43284df5f57..a13fb8f244896 100644 --- a/samples/snippets/csharp/new-in-6/NetworkClient.cs +++ b/samples/snippets/csharp/new-in-6/NetworkClient.cs @@ -29,7 +29,7 @@ public static async Task MakeRequest() // public static async Task MakeRequestAndLogFailures() - { + { await logMethodEntrance(); var client = new System.Net.Http.HttpClient(); var streamTask = client.GetStringAsync("https://localHost:10000"); @@ -70,7 +70,7 @@ public class NetworkClient { // public static async Task MakeRequest() - { + { var client = new System.Net.Http.HttpClient(); var streamTask = client.GetStringAsync("https://localHost:10000"); try { diff --git a/samples/snippets/csharp/new-in-6/Program.cs b/samples/snippets/csharp/new-in-6/Program.cs index b9ddab7289801..da051b5efb894 100644 --- a/samples/snippets/csharp/new-in-6/Program.cs +++ b/samples/snippets/csharp/new-in-6/Program.cs @@ -13,10 +13,10 @@ public static void Main(string[] args) var person = new NewStyle.Student("first", "last"); // - var first = person?.FirstName; + var first = person?.FirstName; // - // + // first = person?.FirstName ?? "Unspecified"; // diff --git a/samples/snippets/csharp/new-in-6/overloads.cs b/samples/snippets/csharp/new-in-6/overloads.cs index 9587d6b588584..61fcdd7fa80e3 100644 --- a/samples/snippets/csharp/new-in-6/overloads.cs +++ b/samples/snippets/csharp/new-in-6/overloads.cs @@ -5,16 +5,16 @@ namespace NewStyle public class Example { // - static Task DoThings() + static Task DoThings() { - return Task.FromResult(0); + return Task.FromResult(0); } // public static void TestMethod() { // - Task.Run(DoThings); + Task.Run(DoThings); // // diff --git a/samples/snippets/csharp/new-in-6/viewmodel.cs b/samples/snippets/csharp/new-in-6/viewmodel.cs index 4d5b9f716a2c9..66b53b30cb023 100644 --- a/samples/snippets/csharp/new-in-6/viewmodel.cs +++ b/samples/snippets/csharp/new-in-6/viewmodel.cs @@ -15,7 +15,7 @@ public string LastName if (value != lastName) { lastName = value; - PropertyChanged?.Invoke(this, + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(LastName))); } } @@ -32,7 +32,7 @@ public string FirstName if (value != firstName) { firstName = value; - PropertyChanged?.Invoke(this, + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(UXComponents.ViewModel.FirstName))); } } diff --git a/samples/snippets/csharp/new-in-7/MathUtilities.cs b/samples/snippets/csharp/new-in-7/MathUtilities.cs index bcbca70fc03ca..66c78b2d0ccbd 100644 --- a/samples/snippets/csharp/new-in-7/MathUtilities.cs +++ b/samples/snippets/csharp/new-in-7/MathUtilities.cs @@ -13,7 +13,7 @@ public static int LocalFunctionFactorial(int n) { return nthFactorial(n); - int nthFactorial(int number) => (number < 2) ? + int nthFactorial(int number) => (number < 2) ? 1 : number * nthFactorial(number - 1); } #endregion @@ -23,7 +23,7 @@ public static int LambdaFactorial(int n) { Func nthFactorial = default(Func); - nthFactorial = (number) => (number < 2) ? + nthFactorial = (number) => (number < 2) ? 1 : number * nthFactorial(number - 1); return nthFactorial(n); diff --git a/samples/snippets/csharp/new-in-7/Point.cs b/samples/snippets/csharp/new-in-7/Point.cs index 3ce935fa5c4e0..90eee1ce537e9 100644 --- a/samples/snippets/csharp/new-in-7/Point.cs +++ b/samples/snippets/csharp/new-in-7/Point.cs @@ -3,9 +3,9 @@ // public class Point { - public Point(double x, double y) + public Point(double x, double y) => (X, Y) = (x, y); - + public double X { get; } public double Y { get; } diff --git a/samples/snippets/csharp/objectoriented/Inheritance.cs b/samples/snippets/csharp/objectoriented/Inheritance.cs index edb95bed0b9fc..40c8e38c96d03 100644 --- a/samples/snippets/csharp/objectoriented/Inheritance.cs +++ b/samples/snippets/csharp/objectoriented/Inheritance.cs @@ -19,7 +19,7 @@ public class WorkItem // Default constructor. If a derived class does not invoke a base- // class constructor explicitly, the default constructor is called - // implicitly. + // implicitly. public WorkItem() { ID = 0; @@ -60,15 +60,15 @@ public override string ToString() => $"{this.ID} - {this.Title}"; } - // ChangeRequest derives from WorkItem and adds a property (originalItemID) + // ChangeRequest derives from WorkItem and adds a property (originalItemID) // and two constructors. public class ChangeRequest : WorkItem { protected int originalItemID { get; set; } - // Constructors. Because neither constructor calls a base-class + // Constructors. Because neither constructor calls a base-class // constructor explicitly, the default constructor in the base class - // is called implicitly. The base class must contain a default + // is called implicitly. The base class must contain a default // constructor. // Default constructor for the derived class. @@ -78,14 +78,14 @@ public ChangeRequest() { } public ChangeRequest(string title, string desc, TimeSpan jobLen, int originalID) { - // The following properties and the GetNexID method are inherited + // The following properties and the GetNexID method are inherited // from WorkItem. this.ID = GetNextID(); this.Title = title; this.Description = desc; this.jobLength = jobLen; - // Property originalItemId is a member of ChangeRequest, but not + // Property originalItemId is a member of ChangeRequest, but not // of WorkItem. this.originalItemID = originalID; } @@ -101,7 +101,7 @@ public class Shape public int Y { get; private set; } public int Height { get; set; } public int Width { get; set; } - + // Virtual method public virtual void Draw() { @@ -145,7 +145,7 @@ public static void Example() // // Polymorphism at work #1: a Rectangle, Triangle and Circle // can all be used whereever a Shape is expected. No cast is - // required because an implicit conversion exists from a derived + // required because an implicit conversion exists from a derived // class to its base class. var shapes = new List { @@ -246,7 +246,7 @@ static class Inheritance public static void Example() { // - // Create an instance of WorkItem by using the constructor in the + // Create an instance of WorkItem by using the constructor in the // base class that takes three arguments. WorkItem item = new WorkItem("Fix Bugs", "Fix all bugs in my code branch", @@ -262,7 +262,7 @@ public static void Example() // Use the ToString method defined in WorkItem. Console.WriteLine(item.ToString()); - // Use the inherited Update method to change the title of the + // Use the inherited Update method to change the title of the // ChangeRequest object. change.Update("Change the Design of the Base Class", new TimeSpan(4, 0, 0)); diff --git a/samples/snippets/csharp/objectoriented/interfaces.cs b/samples/snippets/csharp/objectoriented/interfaces.cs index bc2dee838b0e1..16f82cadb15ac 100644 --- a/samples/snippets/csharp/objectoriented/interfaces.cs +++ b/samples/snippets/csharp/objectoriented/interfaces.cs @@ -22,11 +22,11 @@ public class Car : IEquatable // Implementation of IEquatable interface public bool Equals(Car car) { - return (this.Make, this.Model, this.Year) == + return (this.Make, this.Model, this.Year) == (car.Make, car.Model, car.Year); } } // - + } \ No newline at end of file diff --git a/samples/snippets/csharp/pipelines/DoNotUse.cs b/samples/snippets/csharp/pipelines/DoNotUse.cs index 764a92527bc9f..9b233a2a3e751 100644 --- a/samples/snippets/csharp/pipelines/DoNotUse.cs +++ b/samples/snippets/csharp/pipelines/DoNotUse.cs @@ -170,7 +170,7 @@ private async Task Memory_Corruption(PipeReader reader, CancellationTok if (message != null) { - // This code is broken since reader.AdvanceTo() was called with a position *after* the buffer + // This code is broken since reader.AdvanceTo() was called with a position *after* the buffer // was captured. break; } diff --git a/samples/snippets/csharp/pipelines/MyConnection.cs b/samples/snippets/csharp/pipelines/MyConnection.cs index 4e783bf468c68..1dd420803bd7e 100644 --- a/samples/snippets/csharp/pipelines/MyConnection.cs +++ b/samples/snippets/csharp/pipelines/MyConnection.cs @@ -40,7 +40,7 @@ public async Task ProcessMessagesAsync() break; } - // Process all messages from the buffer, modifying the input buffer on each + // Process all messages from the buffer, modifying the input buffer on each // iteration. while (TryParseMessage(ref buffer, out Message message)) { @@ -55,7 +55,7 @@ public async Task ProcessMessagesAsync() } finally { - // Since all messages in the buffer are being processed, you can use the + // Since all messages in the buffer are being processed, you can use the // remaining buffer's Start and End position to determine consumed and examined. reader.AdvanceTo(buffer.Start, buffer.End); } diff --git a/samples/snippets/csharp/pipelines/MyConnection1.cs b/samples/snippets/csharp/pipelines/MyConnection1.cs index 582a54ca51479..674cda3265bb1 100644 --- a/samples/snippets/csharp/pipelines/MyConnection1.cs +++ b/samples/snippets/csharp/pipelines/MyConnection1.cs @@ -22,7 +22,7 @@ async Task ProcessMessagesAsync(PipeReader reader, CancellationToken cancellatio try { - // Process all messages from the buffer, modifying the input buffer on each + // Process all messages from the buffer, modifying the input buffer on each // iteration. while (TryParseMessage(ref buffer, out Message message)) { @@ -42,7 +42,7 @@ async Task ProcessMessagesAsync(PipeReader reader, CancellationToken cancellatio } finally { - // Since all messages in the buffer are being processed, you can use the + // Since all messages in the buffer are being processed, you can use the // remaining buffer's Start and End position to determine consumed and examined. reader.AdvanceTo(buffer.Start, buffer.End); } diff --git a/samples/snippets/csharp/pipelines/MyPipeWriter.cs b/samples/snippets/csharp/pipelines/MyPipeWriter.cs index d5ebc5157d794..31e64c5e8f540 100644 --- a/samples/snippets/csharp/pipelines/MyPipeWriter.cs +++ b/samples/snippets/csharp/pipelines/MyPipeWriter.cs @@ -23,7 +23,7 @@ async Task WriteHelloAsync(PipeWriter writer, CancellationToken cancellationToke await writer.FlushAsync(cancellationToken); } - #endregion + #endregion } class MyPipeWriter2 @@ -34,7 +34,7 @@ async Task WriteHelloAsync(PipeWriter writer, CancellationToken cancellationToke { byte[] helloBytes = Encoding.ASCII.GetBytes("Hello"); - // Write helloBytes to the writer, there's no need to call Advance here + // Write helloBytes to the writer, there's no need to call Advance here // (Write does that). await writer.WriteAsync(helloBytes, cancellationToken); } diff --git a/samples/snippets/csharp/pipelines/ReadSingleMsg.cs b/samples/snippets/csharp/pipelines/ReadSingleMsg.cs index e5584cafeaca4..0daa86c54576e 100644 --- a/samples/snippets/csharp/pipelines/ReadSingleMsg.cs +++ b/samples/snippets/csharp/pipelines/ReadSingleMsg.cs @@ -19,7 +19,7 @@ async ValueTask ReadSingleMessageAsync(PipeReader reader, ReadResult result = await reader.ReadAsync(cancellationToken); ReadOnlySequence buffer = result.Buffer; - // In the event that no message is parsed successfully, mark consumed + // In the event that no message is parsed successfully, mark consumed // as nothing and examined as the entire buffer. SequencePosition consumed = buffer.Start; SequencePosition examined = buffer.End; @@ -28,13 +28,13 @@ async ValueTask ReadSingleMessageAsync(PipeReader reader, { if (TryParseMessage(ref buffer, out Message message)) { - // A single message was successfully parsed so mark the start as the - // parsed buffer as consumed. TryParseMessage trims the buffer to + // A single message was successfully parsed so mark the start as the + // parsed buffer as consumed. TryParseMessage trims the buffer to // point to the data after the message was parsed. consumed = buffer.Start; - // Examined is marked the same as consumed here, so the next call - // to ReadSingleMessageAsync will process the next message if there's + // Examined is marked the same as consumed here, so the next call + // to ReadSingleMessageAsync will process the next message if there's // one. examined = consumed; diff --git a/samples/snippets/csharp/programming-guide/classes-and-structs/class1.cs b/samples/snippets/csharp/programming-guide/classes-and-structs/class1.cs index aa72a5bec0262..5519b441bdf95 100644 --- a/samples/snippets/csharp/programming-guide/classes-and-structs/class1.cs +++ b/samples/snippets/csharp/programming-guide/classes-and-structs/class1.cs @@ -42,5 +42,5 @@ static void Main(string[] args) } } // The example displays the following output: -// The result is 108. +// The result is 108. // diff --git a/samples/snippets/csharp/programming-guide/classes-and-structs/constructors1.cs b/samples/snippets/csharp/programming-guide/classes-and-structs/constructors1.cs index 93e1622781ed8..c47d263e264f3 100644 --- a/samples/snippets/csharp/programming-guide/classes-and-structs/constructors1.cs +++ b/samples/snippets/csharp/programming-guide/classes-and-structs/constructors1.cs @@ -16,13 +16,13 @@ public class Person { private string last; private string first; - + public Person(string lastName, string firstName) { last = lastName; first = firstName; } - + // Remaining implementation of Person class. } // @@ -31,7 +31,7 @@ public Person(string lastName, string firstName) public class Adult : Person { private static int minimumAge; - + public Adult(string lastName, string firstName) : base(lastName, firstName) { } @@ -48,7 +48,7 @@ static Adult() public class Child : Person { private static int maximumAge; - + public Child(string lastName, string firstName) : base(lastName, firstName) { } diff --git a/samples/snippets/csharp/programming-guide/classes-and-structs/expr-bodied-ctor.cs b/samples/snippets/csharp/programming-guide/classes-and-structs/expr-bodied-ctor.cs index 4e48d9b5c6cc4..4129b6b752002 100644 --- a/samples/snippets/csharp/programming-guide/classes-and-structs/expr-bodied-ctor.cs +++ b/samples/snippets/csharp/programming-guide/classes-and-structs/expr-bodied-ctor.cs @@ -4,14 +4,14 @@ public class Location { private string locationName; - + public Location(string name) => Name = name; public string Name { get => locationName; set => locationName = value; - } + } } // diff --git a/samples/snippets/csharp/programming-guide/classes-and-structs/expr-bodied-destructor.cs b/samples/snippets/csharp/programming-guide/classes-and-structs/expr-bodied-destructor.cs index 622d36fe7e152..636d229c53bee 100644 --- a/samples/snippets/csharp/programming-guide/classes-and-structs/expr-bodied-destructor.cs +++ b/samples/snippets/csharp/programming-guide/classes-and-structs/expr-bodied-destructor.cs @@ -4,7 +4,7 @@ public class Destroyer { public override string ToString() => GetType().Name; - + ~Destroyer() => Console.WriteLine($"The {ToString()} destructor is executing."); } // diff --git a/samples/snippets/csharp/programming-guide/classes-and-structs/expr-bodied-indexers.cs b/samples/snippets/csharp/programming-guide/classes-and-structs/expr-bodied-indexers.cs index 1dec931e39933..8a736222d870c 100644 --- a/samples/snippets/csharp/programming-guide/classes-and-structs/expr-bodied-indexers.cs +++ b/samples/snippets/csharp/programming-guide/classes-and-structs/expr-bodied-indexers.cs @@ -4,9 +4,9 @@ public class Sports { - private string[] types = { "Baseball", "Basketball", "Football", - "Hockey", "Soccer", "Tennis", - "Volleyball" }; + private string[] types = { "Baseball", "Basketball", "Football", + "Hockey", "Soccer", "Tennis", + "Volleyball" }; public string this[int i] { diff --git a/samples/snippets/csharp/programming-guide/classes-and-structs/expr-bodied-methods.cs b/samples/snippets/csharp/programming-guide/classes-and-structs/expr-bodied-methods.cs index 27fb912340c49..67f6bed889f4e 100644 --- a/samples/snippets/csharp/programming-guide/classes-and-structs/expr-bodied-methods.cs +++ b/samples/snippets/csharp/programming-guide/classes-and-structs/expr-bodied-methods.cs @@ -10,7 +10,7 @@ public Person(string firstName, string lastName) private string fname; private string lname; - + public override string ToString() => $"{fname} {lname}".Trim(); public void DisplayName() => Console.WriteLine(ToString()); } diff --git a/samples/snippets/csharp/programming-guide/classes-and-structs/expr-bodied-readonly.cs b/samples/snippets/csharp/programming-guide/classes-and-structs/expr-bodied-readonly.cs index 7ae6876f50e4f..dca5818c389ef 100644 --- a/samples/snippets/csharp/programming-guide/classes-and-structs/expr-bodied-readonly.cs +++ b/samples/snippets/csharp/programming-guide/classes-and-structs/expr-bodied-readonly.cs @@ -4,7 +4,7 @@ public class Location { private string locationName; - + public Location(string name) { locationName = name; diff --git a/samples/snippets/csharp/programming-guide/classes-and-structs/local-functions-async1.cs b/samples/snippets/csharp/programming-guide/classes-and-structs/local-functions-async1.cs index 00277597d92f9..e31eb527f063f 100644 --- a/samples/snippets/csharp/programming-guide/classes-and-structs/local-functions-async1.cs +++ b/samples/snippets/csharp/programming-guide/classes-and-structs/local-functions-async1.cs @@ -14,17 +14,17 @@ static async Task GetMultipleAsync(int secondsDelay) Console.WriteLine("Executing GetMultipleAsync..."); if (secondsDelay < 0 || secondsDelay > 5) throw new ArgumentOutOfRangeException("secondsDelay cannot exceed 5."); // Line 16 - + await Task.Delay(secondsDelay * 1000); return secondsDelay * new Random().Next(2,10); - } + } } // The example displays the following output: // Executing GetMultipleAsync... // -// Unhandled Exception: System.AggregateException: +// Unhandled Exception: System.AggregateException: // One or more errors occurred. (Specified argument was out of the range of valid values. -// Parameter name: secondsDelay cannot exceed 5.) ---> +// Parameter name: secondsDelay cannot exceed 5.) ---> // System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. // Parameter name: secondsDelay cannot exceed 5. // at Example.d__1.MoveNext() in Program.cs:line 16 diff --git a/samples/snippets/csharp/programming-guide/classes-and-structs/local-functions-async2.cs b/samples/snippets/csharp/programming-guide/classes-and-structs/local-functions-async2.cs index 317ad51353222..f848402c8f83e 100644 --- a/samples/snippets/csharp/programming-guide/classes-and-structs/local-functions-async2.cs +++ b/samples/snippets/csharp/programming-guide/classes-and-structs/local-functions-async2.cs @@ -13,19 +13,19 @@ static Task GetMultiple(int secondsDelay) { if (secondsDelay < 0 || secondsDelay > 5) throw new ArgumentOutOfRangeException("secondsDelay cannot exceed 5."); // Line 15 - + return GetValueAsync(); - + async Task GetValueAsync() { Console.WriteLine("Executing GetValueAsync..."); await Task.Delay(secondsDelay * 1000); return secondsDelay * new Random().Next(2,10); - } - } + } + } } // The example displays the following output: -// Unhandled Exception: System.ArgumentOutOfRangeException: +// Unhandled Exception: System.ArgumentOutOfRangeException: // Specified argument was out of the range of valid values. // Parameter name: secondsDelay cannot exceed 5. // at Example.GetMultiple(Int32 secondsDelay) in Program.cs:line 15 diff --git a/samples/snippets/csharp/programming-guide/classes-and-structs/local-functions-iterator1.cs b/samples/snippets/csharp/programming-guide/classes-and-structs/local-functions-iterator1.cs index b16d5c6a3cc84..d653eeacb4918 100644 --- a/samples/snippets/csharp/programming-guide/classes-and-structs/local-functions-iterator1.cs +++ b/samples/snippets/csharp/programming-guide/classes-and-structs/local-functions-iterator1.cs @@ -7,7 +7,7 @@ static void Main() { IEnumerable ienum = OddSequence(50, 110); Console.WriteLine("Retrieved enumerator..."); - + foreach (var i in ienum) //Line 11 { Console.Write($"{i} "); @@ -22,17 +22,17 @@ public static IEnumerable OddSequence(int start, int end) throw new ArgumentOutOfRangeException("end must be less than or equal to 100."); //Line 22 if (start >= end) throw new ArgumentException("start must be less than end."); - + for (int i = start; i <= end; i++) { if (i % 2 == 1) yield return i; - } + } } } // The example displays the following output: // Retrieved enumerator... -// +// // Unhandled Exception: System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. // Parameter name: end must be less than or equal to 100. // at Sequence.d__1.MoveNext() in Program.cs:line 11 diff --git a/samples/snippets/csharp/programming-guide/classes-and-structs/local-functions-iterator2.cs b/samples/snippets/csharp/programming-guide/classes-and-structs/local-functions-iterator2.cs index 0964985f281a0..829e75547bb77 100644 --- a/samples/snippets/csharp/programming-guide/classes-and-structs/local-functions-iterator2.cs +++ b/samples/snippets/csharp/programming-guide/classes-and-structs/local-functions-iterator2.cs @@ -7,7 +7,7 @@ static void Main() { IEnumerable ienum = OddSequence(50, 110); //Line 8 Console.WriteLine("Retrieved enumerator..."); - + foreach (var i in ienum) { Console.Write($"{i} "); @@ -22,16 +22,16 @@ public static IEnumerable OddSequence(int start, int end) throw new ArgumentOutOfRangeException("end must be less than or equal to 100."); //Line 22 if (start >= end) throw new ArgumentException("start must be less than end."); - + return GetOddSequenceEnumerator(); - + IEnumerable GetOddSequenceEnumerator() { for (int i = start; i <= end; i++) { if (i % 2 == 1) yield return i; - } + } } } } diff --git a/samples/snippets/csharp/programming-guide/classes-and-structs/local-functions1.cs b/samples/snippets/csharp/programming-guide/classes-and-structs/local-functions1.cs index 24ecb5210fc0b..72ef1e587cd12 100644 --- a/samples/snippets/csharp/programming-guide/classes-and-structs/local-functions1.cs +++ b/samples/snippets/csharp/programming-guide/classes-and-structs/local-functions1.cs @@ -8,20 +8,20 @@ static void Main() string contents = GetText(@"C:\temp", "example.txt"); Console.WriteLine("Contents of the file:\n" + contents); } - + private static string GetText(string path, string filename) { var sr = File.OpenText(AppendPathSeparator(path) + filename); var text = sr.ReadToEnd(); return text; - + // Declare a local function. string AppendPathSeparator(string filepath) { if (! filepath.EndsWith(@"\")) filepath += @"\"; - return filepath; + return filepath; } - } + } } diff --git a/samples/snippets/csharp/programming-guide/classes-and-structs/object-collection-initializers/BasicObjectInitializers.cs b/samples/snippets/csharp/programming-guide/classes-and-structs/object-collection-initializers/BasicObjectInitializers.cs index 2ae39fd491b0b..9af2fd4cc986d 100644 --- a/samples/snippets/csharp/programming-guide/classes-and-structs/object-collection-initializers/BasicObjectInitializers.cs +++ b/samples/snippets/csharp/programming-guide/classes-and-structs/object-collection-initializers/BasicObjectInitializers.cs @@ -182,7 +182,7 @@ public static void Main() // public class FullExample - { + { class FormattedAddresses : IEnumerable { private List internalList = new List(); @@ -190,8 +190,8 @@ class FormattedAddresses : IEnumerable System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() => internalList.GetEnumerator(); - public void Add(string firstname, string lastname, - string street, string city, + public void Add(string firstname, string lastname, + string street, string city, string state, string zipcode) => internalList.Add( $@"{firstname} {lastname} {street} @@ -217,7 +217,7 @@ public static void Main() /* * Prints: - + Address Entries: John Doe @@ -233,7 +233,7 @@ 456 Street // public class DictionaryExample - { + { class RudimentaryMultiValuedDictionary : IEnumerable>> { private Dictionary> internalDictionary = new Dictionary>(); @@ -318,7 +318,7 @@ RudimentaryMultiValuedDictionary rudimentaryMultiValuedDictionar /* * Prints: - + Using first multi-valued dictionary created with a collection initializer: Members of group Group1: diff --git a/samples/snippets/csharp/programming-guide/classes-and-structs/object-collection-initializers/HowToDictionaryInitializer.cs b/samples/snippets/csharp/programming-guide/classes-and-structs/object-collection-initializers/HowToDictionaryInitializer.cs index 7fa60ff8014a4..e96d1251165ae 100644 --- a/samples/snippets/csharp/programming-guide/classes-and-structs/object-collection-initializers/HowToDictionaryInitializer.cs +++ b/samples/snippets/csharp/programming-guide/classes-and-structs/object-collection-initializers/HowToDictionaryInitializer.cs @@ -16,7 +16,7 @@ class StudentName } public static void Main() - { + { var students = new Dictionary() { { 111, new StudentName { FirstName="Sachin", LastName="Karnik", ID=211 } }, diff --git a/samples/snippets/csharp/programming-guide/classes-and-structs/object-collection-initializers/HowToObjectInitializers.cs b/samples/snippets/csharp/programming-guide/classes-and-structs/object-collection-initializers/HowToObjectInitializers.cs index 684d8087ea342..4e9faf0f72d6a 100644 --- a/samples/snippets/csharp/programming-guide/classes-and-structs/object-collection-initializers/HowToObjectInitializers.cs +++ b/samples/snippets/csharp/programming-guide/classes-and-structs/object-collection-initializers/HowToObjectInitializers.cs @@ -12,8 +12,8 @@ public static void Main() // Declare a StudentName by using the constructor that has two parameters. StudentName student1 = new StudentName("Craig", "Playstead"); - // Make the same declaration by using an object initializer and sending - // arguments for the first and last names. The default constructor is + // Make the same declaration by using an object initializer and sending + // arguments for the first and last names. The default constructor is // invoked in processing this declaration, not the constructor that has // two parameters. StudentName student2 = new StudentName @@ -22,9 +22,9 @@ public static void Main() LastName = "Playstead", }; - // Declare a StudentName by using an object initializer and sending + // Declare a StudentName by using an object initializer and sending // an argument for only the ID property. No corresponding constructor is - // necessary. Only the default constructor is used to process object + // necessary. Only the default constructor is used to process object // initializers. StudentName student3 = new StudentName { @@ -32,7 +32,7 @@ public static void Main() }; // Declare a StudentName by using an object initializer and sending - // arguments for all three properties. No corresponding constructor is + // arguments for all three properties. No corresponding constructor is // defined in the class. StudentName student4 = new StudentName { @@ -54,15 +54,15 @@ public static void Main() public class StudentName { - // The default constructor has no parameters. The default constructor - // is invoked in the processing of object initializers. - // You can test this by changing the access modifier from public to - // private. The declarations in Main that use object initializers will + // The default constructor has no parameters. The default constructor + // is invoked in the processing of object initializers. + // You can test this by changing the access modifier from public to + // private. The declarations in Main that use object initializers will // fail. public StudentName() { } - // The following constructor has parameters for two of the three - // properties. + // The following constructor has parameters for two of the three + // properties. public StudentName(string first, string last) { FirstName = first; diff --git a/samples/snippets/csharp/programming-guide/classes-and-structs/properties-1.cs b/samples/snippets/csharp/programming-guide/classes-and-structs/properties-1.cs index 707e0ddb5e05e..cd9ffef588fbf 100644 --- a/samples/snippets/csharp/programming-guide/classes-and-structs/properties-1.cs +++ b/samples/snippets/csharp/programming-guide/classes-and-structs/properties-1.cs @@ -7,12 +7,12 @@ class TimePeriod public double Hours { get { return _seconds / 3600; } - set { + set { if (value < 0 || value > 24) throw new ArgumentOutOfRangeException( $"{nameof(value)} must be between 0 and 24."); - _seconds = value * 3600; + _seconds = value * 3600; } } } diff --git a/samples/snippets/csharp/programming-guide/classes-and-structs/properties-2.cs b/samples/snippets/csharp/programming-guide/classes-and-structs/properties-2.cs index 188a5cff112b9..6c2f125baa6bf 100644 --- a/samples/snippets/csharp/programming-guide/classes-and-structs/properties-2.cs +++ b/samples/snippets/csharp/programming-guide/classes-and-structs/properties-2.cs @@ -4,14 +4,14 @@ public class Person { private string _firstName; private string _lastName; - + public Person(string first, string last) { _firstName = first; _lastName = last; } - public string Name => $"{_firstName} {_lastName}"; + public string Name => $"{_firstName} {_lastName}"; } public class Example diff --git a/samples/snippets/csharp/programming-guide/classes-and-structs/properties-3.cs b/samples/snippets/csharp/programming-guide/classes-and-structs/properties-3.cs index d62fa272d1d7e..6f868508f136c 100644 --- a/samples/snippets/csharp/programming-guide/classes-and-structs/properties-3.cs +++ b/samples/snippets/csharp/programming-guide/classes-and-structs/properties-3.cs @@ -4,14 +4,14 @@ public class SaleItem { string _name; decimal _cost; - + public SaleItem(string name, decimal cost) { _name = name; _cost = cost; } - public string Name + public string Name { get => _name; set => _name = value; @@ -20,7 +20,7 @@ public string Name public decimal Price { get => _cost; - set => _cost = value; + set => _cost = value; } } diff --git a/samples/snippets/csharp/programming-guide/classes-and-structs/properties-4.cs b/samples/snippets/csharp/programming-guide/classes-and-structs/properties-4.cs index a11ea6632e87f..dc83059783a78 100644 --- a/samples/snippets/csharp/programming-guide/classes-and-structs/properties-4.cs +++ b/samples/snippets/csharp/programming-guide/classes-and-structs/properties-4.cs @@ -2,7 +2,7 @@ public class SaleItem { - public string Name + public string Name { get; set; } public decimal Price diff --git a/samples/snippets/csharp/programming-guide/deconstructing-tuples/class-discard1.cs b/samples/snippets/csharp/programming-guide/deconstructing-tuples/class-discard1.cs index 5dac541f51ff4..6bcc780f26ee4 100644 --- a/samples/snippets/csharp/programming-guide/deconstructing-tuples/class-discard1.cs +++ b/samples/snippets/csharp/programming-guide/deconstructing-tuples/class-discard1.cs @@ -8,7 +8,7 @@ public class Person public string City { get; set; } public string State { get; set; } - public Person(string fname, string mname, string lname, + public Person(string fname, string mname, string lname, string cityName, string stateName) { FirstName = fname; @@ -32,7 +32,7 @@ public void Deconstruct(out string fname, out string mname, out string lname) lname = LastName; } - public void Deconstruct(out string fname, out string lname, + public void Deconstruct(out string fname, out string lname, out string city, out string state) { fname = FirstName; diff --git a/samples/snippets/csharp/programming-guide/deconstructing-tuples/deconstruct-class2.cs b/samples/snippets/csharp/programming-guide/deconstructing-tuples/deconstruct-class2.cs index 47edcebf5c30a..4bd4c8ceb1ccd 100644 --- a/samples/snippets/csharp/programming-guide/deconstructing-tuples/deconstruct-class2.cs +++ b/samples/snippets/csharp/programming-guide/deconstructing-tuples/deconstruct-class2.cs @@ -8,7 +8,7 @@ public class Person public string City { get; set; } public string State { get; set; } - public Person(string fname, string mname, string lname, + public Person(string fname, string mname, string lname, string cityName, string stateName) { FirstName = fname; @@ -32,7 +32,7 @@ public void Deconstruct(out string fname, out string mname, out string lname) lname = LastName; } - public void Deconstruct(out string fname, out string lname, + public void Deconstruct(out string fname, out string lname, out string city, out string state) { fname = FirstName; diff --git a/samples/snippets/csharp/programming-guide/deconstructing-tuples/deconstruct-extension1.cs b/samples/snippets/csharp/programming-guide/deconstructing-tuples/deconstruct-extension1.cs index 0835d9a84ede1..51a74a6468612 100644 --- a/samples/snippets/csharp/programming-guide/deconstructing-tuples/deconstruct-extension1.cs +++ b/samples/snippets/csharp/programming-guide/deconstructing-tuples/deconstruct-extension1.cs @@ -32,11 +32,11 @@ public static void Deconstruct(this PropertyInfo p, out bool hasGetAndSet, string setAccessTemp = null; MethodInfo getter = null; - if (p.CanRead) + if (p.CanRead) getter = p.GetMethod; MethodInfo setter = null; - if (p.CanWrite) + if (p.CanWrite) setter = p.SetMethod; if (setter != null && getter != null) @@ -52,7 +52,7 @@ public static void Deconstruct(this PropertyInfo p, out bool hasGetAndSet, getAccessTemp = "internal"; else if (getter.IsFamily) getAccessTemp = "protected"; - else if (getter.IsFamilyOrAssembly) + else if (getter.IsFamilyOrAssembly) getAccessTemp = "protected internal"; } @@ -100,7 +100,7 @@ public static void Main() Console.WriteLine($" Indexed: {isIndexed}"); Type listType = typeof(List<>); - prop = listType.GetProperty("Item", + prop = listType.GetProperty("Item", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static); var (hasGetAndSet, sameAccess, accessibility, getAccessibility, setAccessibility) = prop; Console.Write($"\nAccessibility of the {listType.FullName}.{prop.Name} property: "); @@ -122,5 +122,5 @@ public static void Main() // Static: True // Read-only: True // Indexed: False -// +// // Accessibility of the System.Collections.Generic.List`1.Item property: public diff --git a/samples/snippets/csharp/programming-guide/deconstructing-tuples/discard-tuple1.cs b/samples/snippets/csharp/programming-guide/deconstructing-tuples/discard-tuple1.cs index 74a5ce03b6728..7b33847b67027 100644 --- a/samples/snippets/csharp/programming-guide/deconstructing-tuples/discard-tuple1.cs +++ b/samples/snippets/csharp/programming-guide/deconstructing-tuples/discard-tuple1.cs @@ -9,15 +9,15 @@ public static void Main() Console.WriteLine($"Population change, 1960 to 2010: {pop2 - pop1:N0}"); } - + private static (string, double, int, int, int, int) QueryCityDataForYears(string name, int year1, int year2) { int population1 = 0, population2 = 0; double area = 0; - + if (name == "New York City") { - area = 468.48; + area = 468.48; if (year1 == 1960) { population1 = 7781984; diff --git a/samples/snippets/csharp/programming-guide/discards/discard-out1.cs b/samples/snippets/csharp/programming-guide/discards/discard-out1.cs index 6d2a3d6ff31d9..3967f01aa3e94 100644 --- a/samples/snippets/csharp/programming-guide/discards/discard-out1.cs +++ b/samples/snippets/csharp/programming-guide/discards/discard-out1.cs @@ -6,12 +6,12 @@ public static void Main() { string[] dateStrings = {"05/01/2018 14:57:32.8", "2018-05-01 14:57:32.8", "2018-05-01T14:57:32.8375298-04:00", "5/01/2018", - "5/01/2018 14:57:32.80 -07:00", - "1 May 2018 2:57:32.8 PM", "16-05-2018 1:00:32 PM", + "5/01/2018 14:57:32.80 -07:00", + "1 May 2018 2:57:32.8 PM", "16-05-2018 1:00:32 PM", "Fri, 15 May 2018 20:10:57 GMT" }; foreach (string dateString in dateStrings) { - if (DateTime.TryParse(dateString, out _)) + if (DateTime.TryParse(dateString, out _)) Console.WriteLine($"'{dateString}': valid"); else Console.WriteLine($"'{dateString}': invalid"); diff --git a/samples/snippets/csharp/programming-guide/discards/discard-pattern2.cs b/samples/snippets/csharp/programming-guide/discards/discard-pattern2.cs index d0d54af555de7..3cfe9c4411f85 100644 --- a/samples/snippets/csharp/programming-guide/discards/discard-pattern2.cs +++ b/samples/snippets/csharp/programming-guide/discards/discard-pattern2.cs @@ -5,15 +5,15 @@ public class Example { public static void Main() { - object[] objects = { CultureInfo.CurrentCulture, - CultureInfo.CurrentCulture.DateTimeFormat, + object[] objects = { CultureInfo.CurrentCulture, + CultureInfo.CurrentCulture.DateTimeFormat, CultureInfo.CurrentCulture.NumberFormat, new ArgumentException(), null }; foreach (var obj in objects) ProvidesFormatInfo(obj); } - private static void ProvidesFormatInfo(object obj) + private static void ProvidesFormatInfo(object obj) { switch (obj) { diff --git a/samples/snippets/csharp/programming-guide/discards/standalone-discard1.cs b/samples/snippets/csharp/programming-guide/discards/standalone-discard1.cs index 93e0718b536a9..625a6e3519cf1 100644 --- a/samples/snippets/csharp/programming-guide/discards/standalone-discard1.cs +++ b/samples/snippets/csharp/programming-guide/discards/standalone-discard1.cs @@ -9,15 +9,15 @@ public static async Task Main(string[] args) } private static async Task ExecuteAsyncMethods() - { + { Console.WriteLine("About to launch a task..."); - _ = Task.Run(() => { var iterations = 0; + _ = Task.Run(() => { var iterations = 0; for (int ctr = 0; ctr < int.MaxValue; ctr++) iterations++; Console.WriteLine("Completed looping operation..."); throw new InvalidOperationException(); }); - await Task.Delay(5000); + await Task.Delay(5000); Console.WriteLine("Exiting after 5 second delay"); } } diff --git a/samples/snippets/csharp/programming-guide/discards/standalone-discard2.cs b/samples/snippets/csharp/programming-guide/discards/standalone-discard2.cs index f507f4732d6b7..18052402a3951 100644 --- a/samples/snippets/csharp/programming-guide/discards/standalone-discard2.cs +++ b/samples/snippets/csharp/programming-guide/discards/standalone-discard2.cs @@ -28,21 +28,21 @@ private static bool RoundTrips(int _) return _ == newValue; } // The example displays the following compiler error: - // error CS0029: Cannot implicitly convert type 'bool' to 'int' + // error CS0029: Cannot implicitly convert type 'bool' to 'int' // // - public void DoSomething(int _) + public void DoSomething(int _) { var _ = GetValue(); // Error: cannot declare local _ when one is already in scope - } + } // The example displays the following compiler error: - // error CS0136: - // A local or parameter named '_' cannot be declared in this scope - // because that name is used in an enclosing local scope - // to define a local or parameter + // error CS0136: + // A local or parameter named '_' cannot be declared in this scope + // because that name is used in an enclosing local scope + // to define a local or parameter // - + private int GetValue() { return 3; diff --git a/samples/snippets/csharp/programming-guide/indexers/indexer-2.cs b/samples/snippets/csharp/programming-guide/indexers/indexer-2.cs index 2ab6d153ef554..e8dbd78d30986 100644 --- a/samples/snippets/csharp/programming-guide/indexers/indexer-2.cs +++ b/samples/snippets/csharp/programming-guide/indexers/indexer-2.cs @@ -5,13 +5,13 @@ class SampleCollection // Declare an array to store the data elements. private T[] arr = new T[100]; int nextIndex = 0; - + // Define the indexer to allow client code to use [] notation. public T this[int i] => arr[i]; - + public void Add(T value) { - if (nextIndex >= arr.Length) + if (nextIndex >= arr.Length) throw new IndexOutOfRangeException($"The collection can hold only {arr.Length} elements."); arr[nextIndex++] = value; } diff --git a/samples/snippets/csharp/programming-guide/indexers/indexer-3.cs b/samples/snippets/csharp/programming-guide/indexers/indexer-3.cs index 6accf36e3d3df..88965f7bc5c7e 100644 --- a/samples/snippets/csharp/programming-guide/indexers/indexer-3.cs +++ b/samples/snippets/csharp/programming-guide/indexers/indexer-3.cs @@ -8,8 +8,8 @@ class SampleCollection // Define the indexer to allow client code to use [] notation. public T this[int i] { - get => arr[i]; - set => arr[i] = value; + get => arr[i]; + set => arr[i] = value; } } diff --git a/samples/snippets/csharp/programming-guide/lambda-expressions/ExpressionAndStatementLambdas.cs b/samples/snippets/csharp/programming-guide/lambda-expressions/ExpressionAndStatementLambdas.cs index 09cdfbef4e659..d1b584e739e70 100644 --- a/samples/snippets/csharp/programming-guide/lambda-expressions/ExpressionAndStatementLambdas.cs +++ b/samples/snippets/csharp/programming-guide/lambda-expressions/ExpressionAndStatementLambdas.cs @@ -19,8 +19,8 @@ public static void Examples() // // - Action greet = name => - { + Action greet = name => + { string greeting = $"Hello {name}!"; Console.WriteLine(greeting); }; diff --git a/samples/snippets/csharp/programming-guide/lambda-expressions/VariableScopeWithLambdas.cs b/samples/snippets/csharp/programming-guide/lambda-expressions/VariableScopeWithLambdas.cs index ece3f388d4af6..55e1f21ca85b4 100644 --- a/samples/snippets/csharp/programming-guide/lambda-expressions/VariableScopeWithLambdas.cs +++ b/samples/snippets/csharp/programming-guide/lambda-expressions/VariableScopeWithLambdas.cs @@ -30,9 +30,9 @@ public void Run(int input) } public static void Main() - { + { var game = new VariableCaptureGame(); - + int gameInput = 5; game.Run(gameInput); diff --git a/samples/snippets/csharp/programming-guide/ref-returns/NumberStore.cs b/samples/snippets/csharp/programming-guide/ref-returns/NumberStore.cs index 541be77d6a926..789e63947bb3b 100644 --- a/samples/snippets/csharp/programming-guide/ref-returns/NumberStore.cs +++ b/samples/snippets/csharp/programming-guide/ref-returns/NumberStore.cs @@ -26,7 +26,7 @@ public static class FirstExample { public static void Tests() { - // + // var store = new NumberStore(); Console.WriteLine($"Original sequence: {store.ToString()}"); int number = 16; diff --git a/samples/snippets/csharp/programming-guide/ref-returns/NumberStoreUpdated.cs b/samples/snippets/csharp/programming-guide/ref-returns/NumberStoreUpdated.cs index cdc383486f93c..edc57bf8b4b5c 100644 --- a/samples/snippets/csharp/programming-guide/ref-returns/NumberStoreUpdated.cs +++ b/samples/snippets/csharp/programming-guide/ref-returns/NumberStoreUpdated.cs @@ -28,7 +28,7 @@ public static class SecondExample { public static void Tests() { - // + // var store = new NumberStore(); Console.WriteLine($"Original sequence: {store.ToString()}"); int number = 16; diff --git a/samples/snippets/csharp/programming-guide/ref-returns/Program.cs b/samples/snippets/csharp/programming-guide/ref-returns/Program.cs index 3a6684f0f808a..71b743858000a 100644 --- a/samples/snippets/csharp/programming-guide/ref-returns/Program.cs +++ b/samples/snippets/csharp/programming-guide/ref-returns/Program.cs @@ -5,7 +5,7 @@ using RefReturnsVersionTwo; public class Example - { + { static void Main(string[] args) { FirstExample.Tests(); diff --git a/samples/snippets/csharp/programming-guide/string-to-number/parse-tryparse2/Program.cs b/samples/snippets/csharp/programming-guide/string-to-number/parse-tryparse2/Program.cs index 49a7a644798b1..5555e0b1e4a2d 100644 --- a/samples/snippets/csharp/programming-guide/string-to-number/parse-tryparse2/Program.cs +++ b/samples/snippets/csharp/programming-guide/string-to-number/parse-tryparse2/Program.cs @@ -6,7 +6,7 @@ public static void Main() { var str = " 10FFxxx"; string numericString = String.Empty; - foreach (var c in str) + foreach (var c in str) { // Check for numeric characters (hex in this case) or leading or trailing spaces. if ((c >= '0' && c <= '9') || (Char.ToUpperInvariant(c) >= 'A' && Char.ToUpperInvariant(c) <= 'F') || c == ' ') { @@ -25,7 +25,7 @@ public static void Main() numericString = ""; foreach (char c in str) { // Check for numeric characters (0-9), a negative sign, or leading or trailing spaces. - if ((c >= '0' && c <= '9') || c == ' ' || c == '-') + if ((c >= '0' && c <= '9') || c == ' ' || c == '-') { numericString = String.Concat(numericString, c); } else diff --git a/samples/snippets/csharp/programming-guide/strings/Strings_1.cs b/samples/snippets/csharp/programming-guide/strings/Strings_1.cs index 3b4c9c7b44a92..4b513be9fc86c 100644 --- a/samples/snippets/csharp/programming-guide/strings/Strings_1.cs +++ b/samples/snippets/csharp/programming-guide/strings/Strings_1.cs @@ -11,15 +11,15 @@ static void Main() Console.WriteLine($"{jh.firstName} {jh.lastName} was an African American poet born in {jh.born}."); Console.WriteLine($"He was first published in {jh.published} at the age of {jh.published - jh.born}."); Console.WriteLine($"He'd be over {Math.Round((2018d - jh.born) / 100d) * 100d} years old today."); - + // Output: // Jupiter Hammon was an African American poet born in 1711. // He was first published in 1761 at the age of 50. - // He'd be over 300 years old today. + // He'd be over 300 years old today. // - + System.Console.WriteLine(); - + // var pw = (firstName: "Phillis", lastName: "Wheatley", born: 1753, published: 1773); Console.WriteLine("{0} {1} was an African American poet born in {2}.", pw.firstName, pw.lastName, pw.born); diff --git a/samples/snippets/csharp/roslyn-sdk/SemanticQuickStart/Program.cs b/samples/snippets/csharp/roslyn-sdk/SemanticQuickStart/Program.cs index cf7e92b3b2b56..35d50019f4823 100644 --- a/samples/snippets/csharp/roslyn-sdk/SemanticQuickStart/Program.cs +++ b/samples/snippets/csharp/roslyn-sdk/SemanticQuickStart/Program.cs @@ -13,7 +13,7 @@ class Program @"using System; using System.Collections.Generic; using System.Text; - + namespace HelloWorld { class Program @@ -91,7 +91,7 @@ static void Main(string[] args) // // var publicStringReturningMethods = methods - .Where(m => m.ReturnType.Equals(stringTypeSymbol) && + .Where(m => m.ReturnType.Equals(stringTypeSymbol) && m.DeclaredAccessibility == Accessibility.Public); // // diff --git a/samples/snippets/csharp/roslyn-sdk/SyntaxQuickStart/HelloSyntaxTree/Program.cs b/samples/snippets/csharp/roslyn-sdk/SyntaxQuickStart/HelloSyntaxTree/Program.cs index d29334b284ff4..408182c9d5dd9 100644 --- a/samples/snippets/csharp/roslyn-sdk/SyntaxQuickStart/HelloSyntaxTree/Program.cs +++ b/samples/snippets/csharp/roslyn-sdk/SyntaxQuickStart/HelloSyntaxTree/Program.cs @@ -15,7 +15,7 @@ class Program using System.Collections; using System.Linq; using System.Text; - + namespace HelloWorld { class Program diff --git a/samples/snippets/csharp/roslyn-sdk/SyntaxQuickStart/SyntaxWalker/Program.cs b/samples/snippets/csharp/roslyn-sdk/SyntaxQuickStart/SyntaxWalker/Program.cs index 82ac13189e87b..c3defff202840 100644 --- a/samples/snippets/csharp/roslyn-sdk/SyntaxQuickStart/SyntaxWalker/Program.cs +++ b/samples/snippets/csharp/roslyn-sdk/SyntaxQuickStart/SyntaxWalker/Program.cs @@ -16,25 +16,25 @@ class Program using System.Text; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; - + namespace TopLevel { using Microsoft; using System.ComponentModel; - + namespace Child1 { using Microsoft.Win32; using System.Runtime.InteropServices; - + class Foo { } } - + namespace Child2 { using System.CodeDom; using Microsoft.CSharp; - + class Bar { } } }"; diff --git a/samples/snippets/csharp/roslyn-sdk/SyntaxTransformationQuickStart/ConstructionCS/Program.cs b/samples/snippets/csharp/roslyn-sdk/SyntaxTransformationQuickStart/ConstructionCS/Program.cs index 3bfe9e7cd9e40..cf198cda1aa06 100644 --- a/samples/snippets/csharp/roslyn-sdk/SyntaxTransformationQuickStart/ConstructionCS/Program.cs +++ b/samples/snippets/csharp/roslyn-sdk/SyntaxTransformationQuickStart/ConstructionCS/Program.cs @@ -13,12 +13,12 @@ namespace ConstructionCS class Program { // - private const string sampleCode = + private const string sampleCode = @"using System; using System.Collections; using System.Linq; using System.Text; - + namespace HelloWorld { class Program diff --git a/samples/snippets/csharp/roslyn-sdk/SyntaxTransformationQuickStart/TransformationCS/Program.cs b/samples/snippets/csharp/roslyn-sdk/SyntaxTransformationQuickStart/TransformationCS/Program.cs index b90ef025654b8..87fea9e4fd125 100644 --- a/samples/snippets/csharp/roslyn-sdk/SyntaxTransformationQuickStart/TransformationCS/Program.cs +++ b/samples/snippets/csharp/roslyn-sdk/SyntaxTransformationQuickStart/TransformationCS/Program.cs @@ -59,8 +59,8 @@ private static Compilation CreateTestCompilation() MetadataReference[] references = { mscorlib, codeAnalysis, csharpCodeAnalysis }; return CSharpCompilation.Create("TransformationCS", - sourceTrees, - references, + sourceTrees, + references, new CSharpCompilationOptions(OutputKind.ConsoleApplication)); // } diff --git a/samples/snippets/csharp/roslyn-sdk/SyntaxTransformationQuickStart/TransformationCS/TypeInferenceRewriter.cs b/samples/snippets/csharp/roslyn-sdk/SyntaxTransformationQuickStart/TransformationCS/TypeInferenceRewriter.cs index 84af2e57c7011..8c0e9a43190d2 100644 --- a/samples/snippets/csharp/roslyn-sdk/SyntaxTransformationQuickStart/TransformationCS/TypeInferenceRewriter.cs +++ b/samples/snippets/csharp/roslyn-sdk/SyntaxTransformationQuickStart/TransformationCS/TypeInferenceRewriter.cs @@ -17,7 +17,7 @@ public class TypeInferenceRewriter : CSharpSyntaxRewriter public TypeInferenceRewriter(SemanticModel semanticModel) => SemanticModel = semanticModel; // - // five + // five public override SyntaxNode VisitLocalDeclarationStatement(LocalDeclarationStatementSyntax node) { // diff --git a/samples/snippets/csharp/safe-efficient-code/benchmark/Program.cs b/samples/snippets/csharp/safe-efficient-code/benchmark/Program.cs index 3196a86118617..ea01e0cebbd90 100644 --- a/samples/snippets/csharp/safe-efficient-code/benchmark/Program.cs +++ b/samples/snippets/csharp/safe-efficient-code/benchmark/Program.cs @@ -71,7 +71,7 @@ public class Benchmarks [Benchmark] public void ImmutableAddByType() - { + { add_by_type(sStruct); } diff --git a/samples/snippets/csharp/safe-efficient-code/ref-readonly-struct/Point3D.cs b/samples/snippets/csharp/safe-efficient-code/ref-readonly-struct/Point3D.cs index 06db451b28b80..f3a2d375b5dba 100644 --- a/samples/snippets/csharp/safe-efficient-code/ref-readonly-struct/Point3D.cs +++ b/samples/snippets/csharp/safe-efficient-code/ref-readonly-struct/Point3D.cs @@ -31,5 +31,5 @@ public ReadonlyPoint3D(double x, double y, double z) private static readonly ReadonlyPoint3D origin = new ReadonlyPoint3D(); public static ref readonly ReadonlyPoint3D Origin => ref origin; } -#endregion +#endregion } diff --git a/samples/snippets/csharp/tour/arrays/Program.cs b/samples/snippets/csharp/tour/arrays/Program.cs index 930379b348a1d..c5f4f90aa9cf0 100644 --- a/samples/snippets/csharp/tour/arrays/Program.cs +++ b/samples/snippets/csharp/tour/arrays/Program.cs @@ -3,14 +3,14 @@ using System; class ArrayExample { - static void Main() + static void Main() { int[] a = new int[10]; - for (int i = 0; i < a.Length; i++) + for (int i = 0; i < a.Length; i++) { a[i] = i * i; } - for (int i = 0; i < a.Length; i++) + for (int i = 0; i < a.Length; i++) { Console.WriteLine($"a[{i}] = {a[i]}"); } @@ -42,7 +42,7 @@ static void ExampleThree() static void ExampleFour() { int[] a = {1, 2, 3}; - } + } static void ExampleFive() { diff --git a/samples/snippets/csharp/tour/attributes/Program.cs b/samples/snippets/csharp/tour/attributes/Program.cs index 49367d0b0e1dc..343feb80d97e0 100644 --- a/samples/snippets/csharp/tour/attributes/Program.cs +++ b/samples/snippets/csharp/tour/attributes/Program.cs @@ -6,7 +6,7 @@ public class HelpAttribute: Attribute { string url; string topic; - public HelpAttribute(string url) + public HelpAttribute(string url) { this.url = url; } @@ -18,11 +18,11 @@ public string Topic { set { topic = value; } } } - + [Help("https://docs.microsoft.com/dotnet/csharp/tour-of-csharp/attributes")] public class Widget { - [Help("https://docs.microsoft.com/dotnet/csharp/tour-of-csharp/attributes", + [Help("https://docs.microsoft.com/dotnet/csharp/tour-of-csharp/attributes", Topic = "Display")] public void Display(string text) {} } diff --git a/samples/snippets/csharp/tour/classes-and-objects/Color.cs b/samples/snippets/csharp/tour/classes-and-objects/Color.cs index 58e1439a2301b..a1278407e2626 100644 --- a/samples/snippets/csharp/tour/classes-and-objects/Color.cs +++ b/samples/snippets/csharp/tour/classes-and-objects/Color.cs @@ -8,7 +8,7 @@ public class Color public static readonly Color Green = new Color(0, 255, 0); public static readonly Color Blue = new Color(0, 0, 255); private byte r, g, b; - public Color(byte r, byte g, byte b) + public Color(byte r, byte g, byte b) { this.r = r; this.g = g; diff --git a/samples/snippets/csharp/tour/classes-and-objects/Entity.cs b/samples/snippets/csharp/tour/classes-and-objects/Entity.cs index c06b7fe8014e5..f6e911da8ce95 100644 --- a/samples/snippets/csharp/tour/classes-and-objects/Entity.cs +++ b/samples/snippets/csharp/tour/classes-and-objects/Entity.cs @@ -3,7 +3,7 @@ using System; class EntityExample { - public static void Usage() + public static void Usage() { Entity.SetNextSerialNo(1000); Entity e1 = new Entity(); @@ -17,19 +17,19 @@ class Entity { static int nextSerialNo; int serialNo; - public Entity() + public Entity() { serialNo = nextSerialNo++; } - public int GetSerialNo() + public int GetSerialNo() { return serialNo; } - public static int GetNextSerialNo() + public static int GetNextSerialNo() { return nextSerialNo; } - public static void SetNextSerialNo(int value) + public static void SetNextSerialNo(int value) { nextSerialNo = value; } diff --git a/samples/snippets/csharp/tour/classes-and-objects/Expressions.cs b/samples/snippets/csharp/tour/classes-and-objects/Expressions.cs index e2b7188b3cdba..f3c2ee5c12c26 100644 --- a/samples/snippets/csharp/tour/classes-and-objects/Expressions.cs +++ b/samples/snippets/csharp/tour/classes-and-objects/Expressions.cs @@ -9,11 +9,11 @@ public abstract class Expression public class Constant: Expression { double value; - public Constant(double value) + public Constant(double value) { this.value = value; } - public override double Evaluate(Dictionary vars) + public override double Evaluate(Dictionary vars) { return value; } @@ -21,14 +21,14 @@ public override double Evaluate(Dictionary vars) public class VariableReference: Expression { string name; - public VariableReference(string name) + public VariableReference(string name) { this.name = name; } - public override double Evaluate(Dictionary vars) + public override double Evaluate(Dictionary vars) { object value = vars[name]; - if (value == null) + if (value == null) { throw new Exception("Unknown variable: " + name); } @@ -40,13 +40,13 @@ public class Operation: Expression Expression left; char op; Expression right; - public Operation(Expression left, char op, Expression right) + public Operation(Expression left, char op, Expression right) { this.left = left; this.op = op; this.right = right; } - public override double Evaluate(Dictionary vars) + public override double Evaluate(Dictionary vars) { double x = left.Evaluate(vars); double y = right.Evaluate(vars); @@ -67,7 +67,7 @@ namespace ClassesAndObjects using System.Collections.Generic; class InheritanceExample { - public static void ExampleUsage() + public static void ExampleUsage() { Expression e = new Operation( new VariableReference("x"), @@ -86,5 +86,5 @@ public static void ExampleUsage() vars["y"] = 9; Console.WriteLine(e.Evaluate(vars)); // Outputs "16.5" } - } + } } \ No newline at end of file diff --git a/samples/snippets/csharp/tour/classes-and-objects/ListBasedExamples.cs b/samples/snippets/csharp/tour/classes-and-objects/ListBasedExamples.cs index baab75ef03e22..a11a133134bb5 100644 --- a/samples/snippets/csharp/tour/classes-and-objects/ListBasedExamples.cs +++ b/samples/snippets/csharp/tour/classes-and-objects/ListBasedExamples.cs @@ -11,21 +11,21 @@ public class MyList int count; // Constructor - public MyList(int capacity = defaultCapacity) + public MyList(int capacity = defaultCapacity) { items = new T[capacity]; } // Properties - public int Count => count; + public int Count => count; - public int Capacity + public int Capacity { get { return items.Length; } - set + set { if (value < count) value = count; - if (value != items.Length) + if (value != items.Length) { T[] newItems = new T[value]; Array.Copy(items, 0, newItems, 0, count); @@ -35,21 +35,21 @@ public int Capacity } // Indexer - public T this[int index] + public T this[int index] { - get + get { return items[index]; } - set + set { items[index] = value; OnChanged(); } } - + // Methods - public void Add(T item) + public void Add(T item) { if (count == Capacity) Capacity = count * 2; items[count] = item; @@ -62,14 +62,14 @@ protected virtual void OnChanged() => public override bool Equals(object other) => Equals(this, other as MyList); - static bool Equals(MyList a, MyList b) + static bool Equals(MyList a, MyList b) { if (Object.ReferenceEquals(a, null)) return Object.ReferenceEquals(b, null); if (Object.ReferenceEquals(b, null) || a.count != b.count) return false; - for (int i = 0; i < a.count; i++) + for (int i = 0; i < a.count; i++) { - if (!object.Equals(a.items[i], b.items[i])) + if (!object.Equals(a.items[i], b.items[i])) { return false; } @@ -81,10 +81,10 @@ static bool Equals(MyList a, MyList b) public event EventHandler Changed; // Operators - public static bool operator ==(MyList a, MyList b) => + public static bool operator ==(MyList a, MyList b) => Equals(a, b); - public static bool operator !=(MyList a, MyList b) => + public static bool operator !=(MyList a, MyList b) => !Equals(a, b); } @@ -110,13 +110,13 @@ public static void ListExampleThree() names.Add("Liz"); names.Add("Martha"); names.Add("Beth"); - for (int i = 0; i < names.Count; i++) + for (int i = 0; i < names.Count; i++) { string s = names[i]; names[i] = s.ToUpper(); } } - public static void ListExampleFour() + public static void ListExampleFour() { MyList a = new MyList(); a.Add(1); @@ -124,7 +124,7 @@ public static void ListExampleFour() MyList b = new MyList(); b.Add(1); b.Add(2); - Console.WriteLine(a == b); // Outputs "True" + Console.WriteLine(a == b); // Outputs "True" b.Add(3); Console.WriteLine(a == b); // Outputs "False" } @@ -132,11 +132,11 @@ public static void ListExampleFour() class EventExample { static int changeCount; - static void ListChanged(object sender, EventArgs e) + static void ListChanged(object sender, EventArgs e) { changeCount++; } - public static void Usage() + public static void Usage() { MyList names = new MyList(); names.Changed += new EventHandler(ListChanged); diff --git a/samples/snippets/csharp/tour/classes-and-objects/OutExample.cs b/samples/snippets/csharp/tour/classes-and-objects/OutExample.cs index 0a4fb7de374f5..998135fb3d8a6 100644 --- a/samples/snippets/csharp/tour/classes-and-objects/OutExample.cs +++ b/samples/snippets/csharp/tour/classes-and-objects/OutExample.cs @@ -3,12 +3,12 @@ using System; class OutExample { - static void Divide(int x, int y, out int result, out int remainder) + static void Divide(int x, int y, out int result, out int remainder) { result = x / y; remainder = x % y; } - public static void OutUsage() + public static void OutUsage() { Divide(10, 3, out int res, out int rem); Console.WriteLine("{0} {1}", res, rem); // Outputs "3 1" diff --git a/samples/snippets/csharp/tour/classes-and-objects/Overloading.cs b/samples/snippets/csharp/tour/classes-and-objects/Overloading.cs index 007926354f048..0866c39913f39 100644 --- a/samples/snippets/csharp/tour/classes-and-objects/Overloading.cs +++ b/samples/snippets/csharp/tour/classes-and-objects/Overloading.cs @@ -3,27 +3,27 @@ using System; class OverloadingExample { - static void F() + static void F() { Console.WriteLine("F()"); } - static void F(object x) + static void F(object x) { Console.WriteLine("F(object)"); } - static void F(int x) + static void F(int x) { Console.WriteLine("F(int)"); } - static void F(double x) + static void F(double x) { Console.WriteLine("F(double)"); } - static void F(T x) + static void F(T x) { Console.WriteLine("F(T)"); } - static void F(double x, double y) + static void F(double x, double y) { Console.WriteLine("F(double, double)"); } @@ -39,5 +39,5 @@ public static void UsageExample() F(1, 1); // Invokes F(double, double) } } - + } \ No newline at end of file diff --git a/samples/snippets/csharp/tour/classes-and-objects/Point.cs b/samples/snippets/csharp/tour/classes-and-objects/Point.cs index 7b1c2e8942416..2e83b13b6fc53 100644 --- a/samples/snippets/csharp/tour/classes-and-objects/Point.cs +++ b/samples/snippets/csharp/tour/classes-and-objects/Point.cs @@ -3,7 +3,7 @@ public class Point { public int x, y; - public Point(int x, int y) + public Point(int x, int y) { this.x = x; this.y = y; @@ -12,8 +12,8 @@ public Point(int x, int y) public class Point3D: Point { public int z; - public Point3D(int x, int y, int z) : - base(x, y) + public Point3D(int x, int y, int z) : + base(x, y) { this.z = z; } diff --git a/samples/snippets/csharp/tour/classes-and-objects/Program.cs b/samples/snippets/csharp/tour/classes-and-objects/Program.cs index 728543e29d2e0..dd7ab6425d886 100644 --- a/samples/snippets/csharp/tour/classes-and-objects/Program.cs +++ b/samples/snippets/csharp/tour/classes-and-objects/Program.cs @@ -81,5 +81,5 @@ public static void Write(string fmt, params object[] args) { } public static void WriteLine(string fmt, params object[] args) { } // ... } - + } diff --git a/samples/snippets/csharp/tour/classes-and-objects/RefExample.cs b/samples/snippets/csharp/tour/classes-and-objects/RefExample.cs index 93ae20e077bd7..c95895780400a 100644 --- a/samples/snippets/csharp/tour/classes-and-objects/RefExample.cs +++ b/samples/snippets/csharp/tour/classes-and-objects/RefExample.cs @@ -3,13 +3,13 @@ using System; class RefExample { - static void Swap(ref int x, ref int y) + static void Swap(ref int x, ref int y) { int temp = x; x = y; y = temp; } - public static void SwapExample() + public static void SwapExample() { int i = 1, j = 2; Swap(ref i, ref j); diff --git a/samples/snippets/csharp/tour/classes-and-objects/Squares.cs b/samples/snippets/csharp/tour/classes-and-objects/Squares.cs index 0e2c0b1b0557d..097aa782869ef 100644 --- a/samples/snippets/csharp/tour/classes-and-objects/Squares.cs +++ b/samples/snippets/csharp/tour/classes-and-objects/Squares.cs @@ -3,11 +3,11 @@ using System; class Squares { - public static void WriteSquares() + public static void WriteSquares() { int i = 0; int j; - while (i < 10) + while (i < 10) { j = i * i; Console.WriteLine($"{i} x {i} = {j}"); diff --git a/samples/snippets/csharp/tour/delegates/Program.cs b/samples/snippets/csharp/tour/delegates/Program.cs index c54bb43c0dfc9..016220efc1c1e 100644 --- a/samples/snippets/csharp/tour/delegates/Program.cs +++ b/samples/snippets/csharp/tour/delegates/Program.cs @@ -5,28 +5,28 @@ class Multiplier { double factor; - public Multiplier(double factor) + public Multiplier(double factor) { this.factor = factor; } - public double Multiply(double x) + public double Multiply(double x) { return x * factor; } } class DelegateExample { - static double Square(double x) + static double Square(double x) { return x * x; } - static double[] Apply(double[] a, Function f) + static double[] Apply(double[] a, Function f) { double[] result = new double[a.Length]; for (int i = 0; i < a.Length; i++) result[i] = f(a[i]); return result; } - static void Main() + static void Main() { double[] a = {0.0, 0.5, 1.0}; double[] squares = Apply(a, Square); @@ -43,7 +43,7 @@ static void ApplyDelegate() double[] a = {0.0, 0.5, 1.0}; double[] doubles = Apply(a, (double x) => x * 2.0); } - static double[] Apply(double[] a, Function f) + static double[] Apply(double[] a, Function f) { double[] result = new double[a.Length]; for (int i = 0; i < a.Length; i++) result[i] = f(a[i]); diff --git a/samples/snippets/csharp/tour/interfaces/Program.cs b/samples/snippets/csharp/tour/interfaces/Program.cs index 3ad6a8204ebe3..91d76186d0a06 100644 --- a/samples/snippets/csharp/tour/interfaces/Program.cs +++ b/samples/snippets/csharp/tour/interfaces/Program.cs @@ -24,7 +24,7 @@ public class EditBox: IControl, IDataBound { public void Paint() { } public void Bind(Binder b) { } - } + } public class Program { diff --git a/samples/snippets/csharp/tour/program-structure/Program.cs b/samples/snippets/csharp/tour/program-structure/Program.cs index f673d29e8c169..5a0a175a966e6 100644 --- a/samples/snippets/csharp/tour/program-structure/Program.cs +++ b/samples/snippets/csharp/tour/program-structure/Program.cs @@ -4,12 +4,12 @@ namespace Acme.Collections public class Stack { Entry top; - public void Push(object data) + public void Push(object data) { top = new Entry(top, data); } - public object Pop() + public object Pop() { if (top == null) { @@ -19,7 +19,7 @@ public object Pop() top = top.next; return result; } - + class Entry { public Entry next; @@ -39,7 +39,7 @@ namespace StackExample using Acme.Collections; class Example { - static void Main() + static void Main() { Stack s = new Stack(); s.Push(1); diff --git a/samples/snippets/csharp/tour/statements/Program.cs b/samples/snippets/csharp/tour/statements/Program.cs index 2d57fa21f4e67..f3a0e67787852 100644 --- a/samples/snippets/csharp/tour/statements/Program.cs +++ b/samples/snippets/csharp/tour/statements/Program.cs @@ -36,7 +36,7 @@ static void IfStatement(string[] args) { Console.WriteLine("No arguments"); } - else + else { Console.WriteLine("One or more arguments"); } @@ -45,7 +45,7 @@ static void IfStatement(string[] args) static void SwitchStatement(string[] args) { int n = args.Length; - switch (n) + switch (n) { case 0: Console.WriteLine("No arguments"); @@ -62,7 +62,7 @@ static void SwitchStatement(string[] args) static void WhileStatement(string[] args) { int i = 0; - while (i < args.Length) + while (i < args.Length) { Console.WriteLine(args[i]); i++; @@ -72,17 +72,17 @@ static void WhileStatement(string[] args) static void DoStatement(string[] args) { string s; - do + do { s = Console.ReadLine(); Console.WriteLine(s); } while (!string.IsNullOrEmpty(s)); } - + static void ForStatement(string[] args) { - for (int i = 0; i < args.Length; i++) + for (int i = 0; i < args.Length; i++) { Console.WriteLine(args[i]); } @@ -90,7 +90,7 @@ static void ForStatement(string[] args) static void ForEachStatement(string[] args) { - foreach (string s in args) + foreach (string s in args) { Console.WriteLine(s); } @@ -98,10 +98,10 @@ static void ForEachStatement(string[] args) static void BreakStatement(string[] args) { - while (true) + while (true) { string s = Console.ReadLine(); - if (string.IsNullOrEmpty(s)) + if (string.IsNullOrEmpty(s)) break; Console.WriteLine(s); } @@ -109,9 +109,9 @@ static void BreakStatement(string[] args) static void ContinueStatement(string[] args) { - for (int i = 0; i < args.Length; i++) + for (int i = 0; i < args.Length; i++) { - if (args[i].StartsWith("/")) + if (args[i].StartsWith("/")) continue; Console.WriteLine(args[i]); } @@ -124,11 +124,11 @@ static void GoToStatement(string[] args) loop: Console.WriteLine(args[i++]); check: - if (i < args.Length) + if (i < args.Length) goto loop; } - static int Add(int a, int b) + static int Add(int a, int b) { return a + b; } @@ -138,9 +138,9 @@ static void ReturnStatement(string[] args) return; } - static System.Collections.Generic.IEnumerable Range(int start, int end) + static System.Collections.Generic.IEnumerable Range(int start, int end) { - for (int i = start; i < end; i++) + for (int i = start; i < end; i++) { yield return i; } @@ -148,23 +148,23 @@ static System.Collections.Generic.IEnumerable Range(int start, int end) } static void YieldStatement(string[] args) { - foreach (int i in Range(-10,10)) + foreach (int i in Range(-10,10)) { Console.WriteLine(i); } } - static double Divide(double x, double y) + static double Divide(double x, double y) { - if (y == 0) + if (y == 0) throw new DivideByZeroException(); return x / y; } - static void TryCatch(string[] args) + static void TryCatch(string[] args) { - try + try { - if (args.Length != 2) + if (args.Length != 2) { throw new InvalidOperationException("Two numbers required"); } @@ -172,32 +172,32 @@ static void TryCatch(string[] args) double y = double.Parse(args[1]); Console.WriteLine(Divide(x, y)); } - catch (InvalidOperationException e) + catch (InvalidOperationException e) { Console.WriteLine(e.Message); } - finally + finally { Console.WriteLine("Good bye!"); } } - static void CheckedUnchecked(string[] args) + static void CheckedUnchecked(string[] args) { int x = int.MaxValue; - unchecked + unchecked { Console.WriteLine(x + 1); // Overflow } - checked + checked { Console.WriteLine(x + 1); // Exception - } + } } - static void UsingStatement(string[] args) + static void UsingStatement(string[] args) { - using (TextWriter w = File.CreateText("test.txt")) + using (TextWriter w = File.CreateText("test.txt")) { w.WriteLine("Line one"); w.WriteLine("Line two"); @@ -221,18 +221,18 @@ public static void Main(string[] args) Console.WriteLine("Type Mesages. Enter a blank line to end"); DoStatement(args); - + ForStatement(args); ForEachStatement(args); Console.WriteLine("Type Mesages. Enter a blank line to end"); BreakStatement(args); - + ContinueStatement(args); GoToStatement(args); - + ReturnStatement(args); YieldStatement(args); @@ -258,11 +258,11 @@ class Account { decimal balance; private readonly object sync = new object(); - public void Withdraw(decimal amount) + public void Withdraw(decimal amount) { - lock (sync) + lock (sync) { - if (amount > balance) + if (amount > balance) { throw new Exception( "Insufficient funds"); diff --git a/samples/snippets/csharp/tuples/Person.cs b/samples/snippets/csharp/tuples/Person.cs index f334355cce192..d54cd08f2d8af 100644 --- a/samples/snippets/csharp/tuples/Person.cs +++ b/samples/snippets/csharp/tuples/Person.cs @@ -104,13 +104,13 @@ public void Deconstruct(out string firstName, out string lastName) // public override bool Equals(object other) => - (other is Person p) - ? (FirstName, LastName) == (p.FirstName, p.LastName) + (other is Person p) + ? (FirstName, LastName) == (p.FirstName, p.LastName) : false; - public static bool operator ==(Person left, Person right) => - (object.ReferenceEquals(left, null)) - ? (object.ReferenceEquals(right, null)) + public static bool operator ==(Person left, Person right) => + (object.ReferenceEquals(left, null)) + ? (object.ReferenceEquals(right, null)) : left.Equals(right); public static bool operator !=(Person left, Person right) => !(left == right); diff --git a/samples/snippets/csharp/tuples/Program.cs b/samples/snippets/csharp/tuples/Program.cs index d102ae6cd2b57..215fd551bc9ce 100644 --- a/samples/snippets/csharp/tuples/Program.cs +++ b/samples/snippets/csharp/tuples/Program.cs @@ -94,7 +94,7 @@ private static void MemberConversions() } private static void MemberNameConversions() - { + { // (int a, string b) pair = (1, "Hello"); (int z, string y) another = (1, "Hello"); @@ -144,7 +144,7 @@ private static void FunWithProjections() var xCoords = (pt1.X, pt2.X); // There are no semantic names for the fields - // of xCoords. + // of xCoords. // Accessing the first field: Console.WriteLine(xCoords.Item1); @@ -156,7 +156,7 @@ private static void FunWithProjections() private static void AssignmentStatements() { #region 03_VariableCreation - // The 'arity' and 'shape' of all these tuples are compatible. + // The 'arity' and 'shape' of all these tuples are compatible. // The only difference is the field names being used. var unnamed = (42, "The meaning of life"); var anonymous = (16, "a perfect square"); @@ -174,10 +174,10 @@ private static void AssignmentStatements() // unnamed to unnamed: anonymous = unnamed; - + // named tuples. named = differentNamed; - // The field names are not assigned. 'named' still has + // The field names are not assigned. 'named' still has // fields that can be referred to as 'answer' and 'message': Console.WriteLine($"{named.Answer}, {named.Message}"); diff --git a/samples/snippets/csharp/tuples/ProjectionSample.cs b/samples/snippets/csharp/tuples/ProjectionSample.cs index d16d34d4d9754..39437378adfd3 100644 --- a/samples/snippets/csharp/tuples/ProjectionSample.cs +++ b/samples/snippets/csharp/tuples/ProjectionSample.cs @@ -13,7 +13,7 @@ public class ToDoItem public bool IsDone { get; set; } public DateTime DueDate { get; set; } public string Title { get; set; } - public string Notes { get; set; } + public string Notes { get; set; } } #endregion @@ -71,6 +71,6 @@ public class ProjectionSample orderby item.DueDate select (item.ID, item.Title); } - #endregion + #endregion } } diff --git a/samples/snippets/csharp/tuples/Statistics.cs b/samples/snippets/csharp/tuples/Statistics.cs index 96ccf924b3eaa..630f7a71488b2 100644 --- a/samples/snippets/csharp/tuples/Statistics.cs +++ b/samples/snippets/csharp/tuples/Statistics.cs @@ -14,7 +14,7 @@ public static double StandardDeviation(IEnumerable sequence) // Step 1: Compute the Mean: var mean = sequence.Average(); - // Step 2: Compute the square of the differences between each number + // Step 2: Compute the square of the differences between each number // and the mean: var squaredMeanDifferences = from n in sequence select (n - mean) * (n - mean); diff --git a/samples/snippets/csharp/tutorials/attributes/Program.cs b/samples/snippets/csharp/tutorials/attributes/Program.cs index 4fe39ac865ac0..632ae40d0ff74 100644 --- a/samples/snippets/csharp/tutorials/attributes/Program.cs +++ b/samples/snippets/csharp/tutorials/attributes/Program.cs @@ -72,20 +72,20 @@ public class SomeOtherClass { } // - + // [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct)] public class MyAttributeForClassAndStructOnly : Attribute { } // - + // public class Foo { // if the below attribute was uncommented, it would cause a compiler error // [MyAttributeForClassAndStructOnly] - public Foo() + public Foo() { } } // @@ -101,12 +101,12 @@ public void RaisePropertyChanged([CallerMemberName] string propertyName = null) } private string _name; - public string Name + public string Name { get { return _name;} - set + set { - if (value != _name) + if (value != _name) { _name = value; RaisePropertyChanged(); // notice that "Name" is not needed here explicitly diff --git a/samples/snippets/csharp/tutorials/inheritance/base-and-derived.cs b/samples/snippets/csharp/tutorials/inheritance/base-and-derived.cs index baade5f4f80d7..06e48e786e912 100644 --- a/samples/snippets/csharp/tutorials/inheritance/base-and-derived.cs +++ b/samples/snippets/csharp/tutorials/inheritance/base-and-derived.cs @@ -7,14 +7,14 @@ public abstract class Publication { private bool published = false; private DateTime datePublished; - private int totalPages; + private int totalPages; public Publication(string title, string publisher, PublicationType type) { if (String.IsNullOrWhiteSpace(publisher)) throw new ArgumentException("The publisher is required."); Publisher = publisher; - + if (String.IsNullOrWhiteSpace(title)) throw new ArgumentException("The title is required."); Title = title; @@ -29,17 +29,17 @@ public Publication(string title, string publisher, PublicationType type) public PublicationType Type { get; } public string CopyrightName { get; private set; } - + public int CopyrightDate { get; private set; } public int Pages { get { return totalPages; } - set + set { if (value <= 0) throw new ArgumentOutOfRangeException("The number of pages cannot be zero or negative."); - totalPages = value; + totalPages = value; } } @@ -48,9 +48,9 @@ public string GetPublicationDate() if (!published) return "NYP"; else - return datePublished.ToString("d"); + return datePublished.ToString("d"); } - + public void Publish(DateTime datePublished) { published = true; @@ -62,11 +62,11 @@ public void Copyright(string copyrightName, int copyrightDate) if (String.IsNullOrWhiteSpace(copyrightName)) throw new ArgumentException("The name of the copyright holder is required."); CopyrightName = copyrightName; - + int currentYear = DateTime.Now.Year; if (copyrightDate < currentYear - 10 || copyrightDate > currentYear + 2) throw new ArgumentOutOfRangeException($"The copyright year must be between {currentYear - 10} and {currentYear + 1}"); - CopyrightDate = copyrightDate; + CopyrightDate = copyrightDate; } public override string ToString() => Title; @@ -80,14 +80,14 @@ namespace DerivedClasses public sealed class Book : Publication { - public Book(string title, string author, string publisher) : + public Book(string title, string author, string publisher) : this(title, String.Empty, author, publisher) { } public Book(string title, string isbn, string author, string publisher) : base(title, publisher, PublicationType.Book) { // isbn argument must be a 10- or 13-character numeric string without "-" characters. - // We could also determine whether the ISBN is valid by comparing its checksum digit + // We could also determine whether the ISBN is valid by comparing its checksum digit // with a computed checksum. // if (! String.IsNullOrEmpty(isbn)) { @@ -97,16 +97,16 @@ public Book(string title, string isbn, string author, string publisher) : base(t ulong nISBN = 0; if (! UInt64.TryParse(isbn, out nISBN)) throw new ArgumentException("The ISBN can consist of numeric characters only."); - } + } ISBN = isbn; Author = author; } - + public string ISBN { get; } public string Author { get; } - + public Decimal Price { get; private set; } // A three-digit ISO currency symbol. @@ -119,12 +119,12 @@ public Decimal SetPrice(Decimal price, string currency) throw new ArgumentOutOfRangeException("The price cannot be negative."); Decimal oldValue = Price; Price = price; - + if (currency.Length != 3) throw new ArgumentException("The ISO currency symbol is a 3-character string."); Currency = currency; - return oldValue; + return oldValue; } public override bool Equals(object obj) @@ -133,12 +133,12 @@ public override bool Equals(object obj) if (book == null) return false; else - return ISBN == book.ISBN; + return ISBN == book.ISBN; } public override int GetHashCode() => ISBN.GetHashCode(); - public override string ToString() => $"{(String.IsNullOrEmpty(Author) ? "" : Author + ", ")}{Title}"; + public override string ToString() => $"{(String.IsNullOrEmpty(Author) ? "" : Author + ", ")}{Title}"; } // } diff --git a/samples/snippets/csharp/tutorials/inheritance/is-a.cs b/samples/snippets/csharp/tutorials/inheritance/is-a.cs index c793c4a0c105a..c6b55ba8e073b 100644 --- a/samples/snippets/csharp/tutorials/inheritance/is-a.cs +++ b/samples/snippets/csharp/tutorials/inheritance/is-a.cs @@ -23,7 +23,7 @@ public Automobile(string make, string model, int year) } public string Make { get; } - + public string Model { get; } public int Year { get; } diff --git a/samples/snippets/csharp/tutorials/inheritance/private.cs b/samples/snippets/csharp/tutorials/inheritance/private.cs index 1df6d82f46de6..641e475b8bcaa 100644 --- a/samples/snippets/csharp/tutorials/inheritance/private.cs +++ b/samples/snippets/csharp/tutorials/inheritance/private.cs @@ -1,7 +1,7 @@ // using System; -public class A +public class A { private int value = 10; @@ -10,7 +10,7 @@ public class B : A public int GetValue() { return this.value; - } + } } } diff --git a/samples/snippets/csharp/tutorials/inheritance/shape.cs b/samples/snippets/csharp/tutorials/inheritance/shape.cs index 47f8dae9f650b..93486689d81b3 100644 --- a/samples/snippets/csharp/tutorials/inheritance/shape.cs +++ b/samples/snippets/csharp/tutorials/inheritance/shape.cs @@ -4,9 +4,9 @@ public abstract class Shape { public abstract double Area { get; } - + public abstract double Perimeter { get; } - + public override string ToString() => GetType().Name; public static double GetArea(Shape shape) => shape.Area; @@ -27,13 +27,13 @@ public Square(double length) Side = length; } - public double Side { get; } + public double Side { get; } - public override double Area => Math.Pow(Side, 2); + public override double Area => Math.Pow(Side, 2); public override double Perimeter => Side * 4; - public double Diagonal => Math.Round(Math.Sqrt(2) * Side, 2); + public double Diagonal => Math.Round(Math.Sqrt(2) * Side, 2); } public class Rectangle : Shape @@ -50,11 +50,11 @@ public Rectangle(double length, double width) public override double Area => Length * Width; - public override double Perimeter => 2 * Length + 2 * Width; + public override double Perimeter => 2 * Length + 2 * Width; public bool IsSquare() => Length == Width; - public double Diagonal => Math.Round(Math.Sqrt(Math.Pow(Length, 2) + Math.Pow(Width, 2)), 2); + public double Diagonal => Math.Round(Math.Sqrt(Math.Pow(Length, 2) + Math.Pow(Width, 2)), 2); } public class Circle : Shape @@ -62,25 +62,25 @@ public class Circle : Shape public Circle(double radius) { Radius = radius; - } + } - public override double Area => Math.Round(Math.PI * Math.Pow(Radius, 2), 2); + public override double Area => Math.Round(Math.PI * Math.Pow(Radius, 2), 2); - public override double Perimeter => Math.Round(Math.PI * 2 * Radius, 2); + public override double Perimeter => Math.Round(Math.PI * 2 * Radius, 2); // Define a circumference, since it's the more familiar term. - public double Circumference => Perimeter; + public double Circumference => Perimeter; public double Radius { get; } - public double Diameter => Radius * 2; + public double Diameter => Radius * 2; } // } // Namespace definition namespace Example { - + using DerivedClasses; // using System; @@ -104,7 +104,7 @@ public static void Main() Console.WriteLine($" Diagonal: {sq.Diagonal}"); continue; } - } + } } } // The example displays the following output: diff --git a/samples/snippets/csharp/tutorials/inheritance/use-publication.cs b/samples/snippets/csharp/tutorials/inheritance/use-publication.cs index 1484f28444e8f..81421dde5d7ac 100644 --- a/samples/snippets/csharp/tutorials/inheritance/use-publication.cs +++ b/samples/snippets/csharp/tutorials/inheritance/use-publication.cs @@ -21,7 +21,7 @@ public static void ShowPublicationInfo(Publication pub) { string pubDate = pub.GetPublicationDate(); WriteLine($"{pub.Title}, " + - $"{(pubDate == "NYP" ? "Not Yet Published" : "published on " + pubDate):d} by {pub.Publisher}"); + $"{(pubDate == "NYP" ? "Not Yet Published" : "published on " + pubDate):d} by {pub.Publisher}"); } } // The example displays the following output: @@ -36,7 +36,7 @@ public abstract class Publication { private bool published = false; private DateTime datePublished; - private int totalPages; + private int totalPages; public Publication(string title, string publisher, PublicationType type) { @@ -45,7 +45,7 @@ public Publication(string title, string publisher, PublicationType type) else if (String.IsNullOrWhiteSpace(publisher)) throw new ArgumentException("The publisher cannot consist only of white space."); Publisher = publisher; - + if (title == null) throw new ArgumentNullException("The title cannot be null."); else if (String.IsNullOrWhiteSpace(title)) @@ -62,17 +62,17 @@ public Publication(string title, string publisher, PublicationType type) public PublicationType Type { get; } public string CopyrightName { get; private set; } - + public int CopyrightDate { get; private set; } public int Pages { get { return totalPages; } - set + set { if (value <= 0) throw new ArgumentOutOfRangeException("The number of pages cannot be zero or negative."); - totalPages = value; + totalPages = value; } } @@ -81,9 +81,9 @@ public string GetPublicationDate() if (!published) return "NYP"; else - return datePublished.ToString("d"); + return datePublished.ToString("d"); } - + public void Publish(DateTime datePublished) { published = true; @@ -97,11 +97,11 @@ public void Copyright(string copyrightName, int copyrightDate) else if (String.IsNullOrWhiteSpace(copyrightName)) throw new ArgumentException("The name of the copyright holder cannot consist only of white space."); CopyrightName = copyrightName; - + int currentYear = DateTime.Now.Year; if (copyrightDate < currentYear - 10 || copyrightDate > currentYear + 2) throw new ArgumentOutOfRangeException($"The copyright year must be between {currentYear -10} and {currentYear + 1}"); - CopyrightDate = copyrightDate; + CopyrightDate = copyrightDate; } public override string ToString() => Title; @@ -109,14 +109,14 @@ public void Copyright(string copyrightName, int copyrightDate) public sealed class Book : Publication { - public Book(string title, string author, string publisher) : + public Book(string title, string author, string publisher) : this(title, String.Empty, author, publisher) { } public Book(string title, string isbn, string author, string publisher) : base(title, publisher, PublicationType.Book) { // isbn argument must be a 10- or 13-character numeric string without "-" characters. - // We could also determine whether the ISBN is valid by comparing its checksum digit + // We could also determine whether the ISBN is valid by comparing its checksum digit // with a computed checksum. // if (! String.IsNullOrEmpty(isbn)) { @@ -126,16 +126,16 @@ public Book(string title, string isbn, string author, string publisher) : base(t ulong nISBN = 0; if (! UInt64.TryParse(isbn, out nISBN)) throw new ArgumentException("The ISBN can consist of numeric characters only."); - } + } ISBN = isbn; Author = author; } - + public string ISBN { get; } public string Author { get; } - + public Decimal Price { get; private set; } // A three-digit ISO currency symbol. @@ -148,12 +148,12 @@ public Decimal SetPrice(Decimal price, string currency) throw new ArgumentOutOfRangeException("The price cannot be negative."); Decimal oldValue = Price; Price = price; - + if (currency.Length != 3) throw new ArgumentException("The ISO currency symbol is a 3-character string."); Currency = currency; - return oldValue; + return oldValue; } public override bool Equals(object obj) @@ -162,10 +162,10 @@ public override bool Equals(object obj) if (book == null) return false; else - return ISBN == book.ISBN; + return ISBN == book.ISBN; } public override int GetHashCode() => ISBN.GetHashCode(); - public override string ToString() => $"{(String.IsNullOrEmpty(Author) ? "" : Author + ", ")}{Title}"; + public override string ToString() => $"{(String.IsNullOrEmpty(Author) ? "" : Author + ", ")}{Title}"; } diff --git a/samples/snippets/csharp/tutorials/mixins-with-interfaces/Program.cs b/samples/snippets/csharp/tutorials/mixins-with-interfaces/Program.cs index e9a7fc18b9cdc..936c035ba2338 100644 --- a/samples/snippets/csharp/tutorials/mixins-with-interfaces/Program.cs +++ b/samples/snippets/csharp/tutorials/mixins-with-interfaces/Program.cs @@ -44,7 +44,7 @@ private static async Task TestLightCapabilities(ILight light) Console.WriteLine("\tTesting timer function"); await timer.TurnOnFor(1000); Console.WriteLine("\tTimer function completed"); - } + } else { Console.WriteLine("\tTimer function not supported."); diff --git a/samples/snippets/csharp/tutorials/mixins-with-interfaces/UnusedExampleCode.cs b/samples/snippets/csharp/tutorials/mixins-with-interfaces/UnusedExampleCode.cs index b79c1ee5a3e9c..414745f89da72 100644 --- a/samples/snippets/csharp/tutorials/mixins-with-interfaces/UnusedExampleCode.cs +++ b/samples/snippets/csharp/tutorials/mixins-with-interfaces/UnusedExampleCode.cs @@ -4,8 +4,8 @@ using System.Threading.Tasks; using mixins_with_interfaces; -// This file and namespace contains interim samples that are -// included in the text, but aren't part of the fial sample. +// This file and namespace contains interim samples that are +// included in the text, but aren't part of the fial sample. // We want these compiled by our CI build, but they won't be // run in the sample. namespace NotUsedInFinalSample @@ -30,7 +30,7 @@ public class OverheadLight : ILight public override string ToString() => $"The light is {isOn: \"on\", \"off\"}"; } // - + // public interface ITimerLight : ILight { diff --git a/samples/snippets/csharp/wpf/introduction-to-wpf/introduction-to-wpf_34.cs b/samples/snippets/csharp/wpf/introduction-to-wpf/introduction-to-wpf_34.cs index dc5cf491d45ba..96813b882f3ad 100644 --- a/samples/snippets/csharp/wpf/introduction-to-wpf/introduction-to-wpf_34.cs +++ b/samples/snippets/csharp/wpf/introduction-to-wpf/introduction-to-wpf_34.cs @@ -1,6 +1,6 @@ using System; // EventArgs using System.Windows; // DependencyObject, DependencyPropertyChangedEventArgs, - // FrameworkPropertyMetadata, PropertyChangedCallback, + // FrameworkPropertyMetadata, PropertyChangedCallback, // RoutedPropertyChangedEventArgs using System.Windows.Controls; // UserControl diff --git a/samples/snippets/machine-learning/GitHubIssueClassification/csharp/Program.cs b/samples/snippets/machine-learning/GitHubIssueClassification/csharp/Program.cs index 6862e04f54018..7b79426ce2c70 100644 --- a/samples/snippets/machine-learning/GitHubIssueClassification/csharp/Program.cs +++ b/samples/snippets/machine-learning/GitHubIssueClassification/csharp/Program.cs @@ -22,23 +22,23 @@ class Program // static void Main(string[] args) { - // Create MLContext to be shared across the model creation workflow objects + // Create MLContext to be shared across the model creation workflow objects // Set a random seed for repeatable/deterministic results across multiple trainings. // _mlContext = new MLContext(seed: 0); // - // STEP 1: Common data loading configuration + // STEP 1: Common data loading configuration // CreateTextReader(hasHeader: true) - Creates a TextLoader by inferencing the dataset schema from the GitHubIssue data model type. // .Read(_trainDataPath) - Loads the training text file into an IDataView (_trainingDataView) and maps from input columns to IDataView columns. Console.WriteLine($"=============== Loading Dataset ==============="); - + // _trainingDataView = _mlContext.Data.LoadFromTextFile(_trainDataPath,hasHeader: true); // Console.WriteLine($"=============== Finished Loading Dataset ==============="); - + // // var (trainData, testData) = _mlContext.MulticlassClassification.TrainTestSplit(_trainingDataView, testFraction: 0.1); // @@ -80,7 +80,7 @@ public static IEstimator ProcessData() // Console.WriteLine($"=============== Finished Processing Data ==============="); - + // return pipeline; // @@ -91,17 +91,17 @@ public static IEstimator BuildAndTrainModel(IDataView trainingData // STEP 3: Create the training algorithm/trainer // Use the multi-class SDCA algorithm to predict the label using features. //Set the trainer/algorithm and map label to value (original readable state) - // + // var trainingPipeline = pipeline.Append(_mlContext.MulticlassClassification.Trainers.SdcaMaximumEntropy("Label", "Features")) .Append(_mlContext.Transforms.Conversion.MapKeyToValue("PredictedLabel")); - // + // // STEP 4: Train the model fitting to the DataSet Console.WriteLine($"=============== Training the model ==============="); - // + // _trainedModel = trainingPipeline.Fit(trainingDataView); - // + // Console.WriteLine($"=============== Finished Training the model Ending time: {DateTime.Now.ToString()} ==============="); // (OPTIONAL) Try/test a single prediction with the "just-trained model" (Before saving the model) @@ -111,7 +111,7 @@ public static IEstimator BuildAndTrainModel(IDataView trainingData // _predEngine = _mlContext.Model.CreatePredictionEngine(_trainedModel); // - // + // GitHubIssue issue = new GitHubIssue() { Title = "WebSockets communication is slow in my machine", Description = "The WebSockets communication used under the covers by SignalR looks like is going slow in my development machine.." @@ -167,12 +167,12 @@ public static void Evaluate(DataViewSchema trainingDataViewSchema) public static void PredictIssue() { // - ITransformer loadedModel = _mlContext.Model.Load(_modelPath, out var modelInputSchema); + ITransformer loadedModel = _mlContext.Model.Load(_modelPath, out var modelInputSchema); // - // + // GitHubIssue singleIssue = new GitHubIssue() { Title = "Entity Framework crashes", Description = "When connecting to the database, EF is crashing" }; - // + // //Predict label for single hard-coded issue // @@ -190,7 +190,7 @@ public static void PredictIssue() private static void SaveModelAsFile(MLContext mlContext,DataViewSchema trainingDataViewSchema, ITransformer model) { - // + // mlContext.Model.Save(model, trainingDataViewSchema, _modelPath); // diff --git a/samples/snippets/machine-learning/MovieRecommendation/csharp/Program.cs b/samples/snippets/machine-learning/MovieRecommendation/csharp/Program.cs index 29d3d82444998..4d7f20f369e80 100644 --- a/samples/snippets/machine-learning/MovieRecommendation/csharp/Program.cs +++ b/samples/snippets/machine-learning/MovieRecommendation/csharp/Program.cs @@ -13,7 +13,7 @@ class Program static void Main(string[] args) { - // Create MLContext to be shared across the model creation workflow objects + // Create MLContext to be shared across the model creation workflow objects // MLContext mlContext = new MLContext(); // @@ -73,12 +73,12 @@ public static ITransformer BuildAndTrainModel(MLContext mlContext, IDataView tra var options = new MatrixFactorizationTrainer.Options { MatrixColumnIndexColumnName = "userIdEncoded", - MatrixRowIndexColumnName = "movieIdEncoded", + MatrixRowIndexColumnName = "movieIdEncoded", LabelColumnName = "Label", NumberOfIterations = 20, ApproximationRank = 100 }; - + var trainerEstimator = estimator.Append(mlContext.Recommendation().Trainers.MatrixFactorization(options)); // @@ -142,7 +142,7 @@ public static void SaveModel(MLContext mlContext, DataViewSchema trainingDataVie // Save the trained model to .zip file // var modelPath = Path.Combine(Environment.CurrentDirectory, "Data", "MovieRecommenderModel.zip"); - + Console.WriteLine("=============== Saving the model to a file ==============="); mlContext.Model.Save(model, trainingDataViewSchema, modelPath); // diff --git a/samples/snippets/machine-learning/ProductSalesAnomalyDetection/csharp/Program.cs b/samples/snippets/machine-learning/ProductSalesAnomalyDetection/csharp/Program.cs index 7865b9916a3e4..14923c9275d9b 100644 --- a/samples/snippets/machine-learning/ProductSalesAnomalyDetection/csharp/Program.cs +++ b/samples/snippets/machine-learning/ProductSalesAnomalyDetection/csharp/Program.cs @@ -16,7 +16,7 @@ class Program // static void Main(string[] args) { - // Create MLContext to be shared across the model creation workflow objects + // Create MLContext to be shared across the model creation workflow objects // MLContext mlContext = new MLContext(); // @@ -31,7 +31,7 @@ static void Main(string[] args) DetectSpike(mlContext, _docsize, dataView); // - // Changepoint detects pattern persistent changes + // Changepoint detects pattern persistent changes // DetectChangepoint(mlContext, _docsize, dataView); // @@ -40,10 +40,10 @@ static void DetectSpike(MLContext mlContext, int docSize, IDataView productSales { Console.WriteLine("Detect temporary changes in pattern"); - // STEP 2: Set the training algorithm - // + // STEP 2: Set the training algorithm + // var iidSpikeEstimator = mlContext.Transforms.DetectIidSpike(outputColumnName: nameof(ProductSalesPrediction.Prediction), inputColumnName: nameof(ProductSalesData.numSales), confidence: 95, pvalueHistoryLength: docSize / 4); - // + // // STEP 3: Create the transform // Create the spike detection transform @@ -57,11 +57,11 @@ static void DetectSpike(MLContext mlContext, int docSize, IDataView productSales // IDataView transformedData = iidSpikeTransform.Transform(productSales); // - + // var predictions = mlContext.Data.CreateEnumerable(transformedData, reuseRowObject: false); // - + // Console.WriteLine("Alert\tScore\tP-Value"); // @@ -86,10 +86,10 @@ static void DetectChangepoint(MLContext mlContext, int docSize, IDataView produc { Console.WriteLine("Detect Persistent changes in pattern"); - //STEP 2: Set the training algorithm - // + //STEP 2: Set the training algorithm + // var iidChangePointEstimator = mlContext.Transforms.DetectIidChangePoint(outputColumnName: nameof(ProductSalesPrediction.Prediction), inputColumnName: nameof(ProductSalesData.numSales), confidence: 95, changeHistoryLength: docSize / 4); - // + // //STEP 3: Create the transform Console.WriteLine("=============== Training the model Using Change Point Detection Algorithm==============="); @@ -106,7 +106,7 @@ static void DetectChangepoint(MLContext mlContext, int docSize, IDataView produc // var predictions = mlContext.Data.CreateEnumerable(transformedData, reuseRowObject: false); // - + // Console.WriteLine("Alert\tScore\tP-Value\tMartingale value"); // diff --git a/samples/snippets/machine-learning/SentimentAnalysis/csharp/Program.cs b/samples/snippets/machine-learning/SentimentAnalysis/csharp/Program.cs index 8bb8e500a44ac..1d425d19e58a4 100644 --- a/samples/snippets/machine-learning/SentimentAnalysis/csharp/Program.cs +++ b/samples/snippets/machine-learning/SentimentAnalysis/csharp/Program.cs @@ -20,8 +20,8 @@ class Program static void Main(string[] args) { - // Create ML.NET context/local environment - allows you to add steps in order to keep everything together - // as you discover the ML.NET trainers and transforms + // Create ML.NET context/local environment - allows you to add steps in order to keep everything together + // as you discover the ML.NET trainers and transforms // MLContext mlContext = new MLContext(); // @@ -52,8 +52,8 @@ static void Main(string[] args) public static TrainTestData LoadData(MLContext mlContext) { - // Note that this case, loading your training data from a file, - // is the easiest way to get started, but ML.NET also allows you + // Note that this case, loading your training data from a file, + // is the easiest way to get started, but ML.NET also allows you // to load data from databases or in-memory collections. // IDataView dataView = mlContext.Data.LoadFromTextFile(_dataPath, hasHeader: false); @@ -66,21 +66,21 @@ public static TrainTestData LoadData(MLContext mlContext) TrainTestData splitDataView = mlContext.Data.TrainTestSplit(dataView, testFraction: 0.2); // - // + // return splitDataView; - // + // } public static ITransformer BuildAndTrainModel(MLContext mlContext, IDataView splitTrainSet) { // Create a flexible pipeline (composed by a chain of estimators) for creating/training the model. - // This is used to format and clean the data. - // Convert the text column to numeric vectors (Features column) + // This is used to format and clean the data. + // Convert the text column to numeric vectors (Features column) // var estimator = mlContext.Transforms.Text.FeaturizeText(outputColumnName: "Features", inputColumnName: nameof(SentimentData.SentimentText)) // // append the machine learning task to the estimator - // + // .Append(mlContext.BinaryClassification.Trainers.SdcaLogisticRegression(labelColumnName: "Label", featureColumnName: "Features")); // @@ -102,7 +102,7 @@ public static void Evaluate(MLContext mlContext, ITransformer model, IDataView s { // Evaluate the model and show accuracy stats - //Take the data in, make transformations, output the data. + //Take the data in, make transformations, output the data. // Console.WriteLine("=============== Evaluating Model accuracy with Test data==============="); IDataView predictions = model.Transform(splitTestSet); @@ -114,7 +114,7 @@ public static void Evaluate(MLContext mlContext, ITransformer model, IDataView s CalibratedBinaryClassificationMetrics metrics = mlContext.BinaryClassification.Evaluate(predictions, "Label"); // - // The Accuracy metric gets the accuracy of a model, which is the proportion + // The Accuracy metric gets the accuracy of a model, which is the proportion // of correct predictions in the test set. // The AreaUnderROCCurve metric is equal to the probability that the algorithm ranks @@ -181,7 +181,7 @@ public static void UseModelWithBatchItems(MLContext mlContext, ITransformer mode }; // - // Load batch comments just created + // Load batch comments just created // IDataView batchComments = mlContext.Data.LoadFromEnumerable(sentiments); @@ -198,14 +198,14 @@ public static void UseModelWithBatchItems(MLContext mlContext, ITransformer mode // Console.WriteLine(); - + // foreach (SentimentPrediction prediction in predictedResults) { Console.WriteLine($"Sentiment: {prediction.SentimentText} | Prediction: {(Convert.ToBoolean(prediction.Prediction) ? "Positive" : "Negative")} | Probability: {prediction.Probability} "); } Console.WriteLine("=============== End of predictions ==============="); - // + // } } } diff --git a/samples/snippets/machine-learning/TaxiFarePrediction/csharp/Program.cs b/samples/snippets/machine-learning/TaxiFarePrediction/csharp/Program.cs index 8b36ae7f58358..4f0f8a19904ba 100644 --- a/samples/snippets/machine-learning/TaxiFarePrediction/csharp/Program.cs +++ b/samples/snippets/machine-learning/TaxiFarePrediction/csharp/Program.cs @@ -34,7 +34,7 @@ static void Main(string[] args) TestSinglePrediction(mlContext, model); // } - + public static ITransformer Train(MLContext mlContext, string dataPath) { // @@ -57,7 +57,7 @@ public static ITransformer Train(MLContext mlContext, string dataPath) // Console.WriteLine("=============== Create and Train the Model ==============="); - + // var model = pipeline.Fit(dataView); // @@ -102,7 +102,7 @@ private static void TestSinglePrediction(MLContext mlContext, ITransformer model // var predictionFunction = mlContext.Model.CreatePredictionEngine(model); // - //Sample: + //Sample: //vendor_id,rate_code,passenger_count,trip_time_in_secs,trip_distance,payment_type,fare_amount //VTS,1,1,1140,3.75,CRD,15.5 // diff --git a/samples/snippets/machine-learning/TextClassificationTF/csharp/Program.cs b/samples/snippets/machine-learning/TextClassificationTF/csharp/Program.cs index e0286f739c83e..cc6e4a63c51f3 100644 --- a/samples/snippets/machine-learning/TextClassificationTF/csharp/Program.cs +++ b/samples/snippets/machine-learning/TextClassificationTF/csharp/Program.cs @@ -18,7 +18,7 @@ class Program static void Main(string[] args) { - // Create MLContext to be shared across the model creation workflow objects + // Create MLContext to be shared across the model creation workflow objects // MLContext mlContext = new MLContext(); // @@ -116,9 +116,9 @@ public static void PredictSentiment(MLContext mlContext, ITransformer model) // // Predict with TensorFlow pipeline. - // + // var sentimentPrediction = engine.Predict(review); - // + // // Console.WriteLine("Number of classes: {0}", sentimentPrediction.Prediction.Length); @@ -126,10 +126,10 @@ public static void PredictSentiment(MLContext mlContext, ITransformer model) // /////////////////////////////////// Expected output /////////////////////////////////// - // + // // Name: Features, Type: System.Int32, Size: 600 // Name: Prediction/Softmax, Type: System.Single, Size: 2 - // + // // Number of classes: 2 // Is sentiment/review positive ? Yes // Prediction Confidence: 0.65 diff --git a/samples/snippets/machine-learning/TransferLearningTF/csharp/Program.cs b/samples/snippets/machine-learning/TransferLearningTF/csharp/Program.cs index 0e57500dc0c53..18d4bfd63ff00 100644 --- a/samples/snippets/machine-learning/TransferLearningTF/csharp/Program.cs +++ b/samples/snippets/machine-learning/TransferLearningTF/csharp/Program.cs @@ -22,7 +22,7 @@ class Program static void Main(string[] args) { - // Create MLContext to be shared across the model creation workflow objects + // Create MLContext to be shared across the model creation workflow objects // MLContext mlContext = new MLContext(); // @@ -47,7 +47,7 @@ public static ITransformer GenerateModel(MLContext mlContext) .Append(mlContext.Transforms.ResizeImages(outputColumnName: "input", imageWidth: InceptionSettings.ImageWidth, imageHeight: InceptionSettings.ImageHeight, inputColumnName: "input")) .Append(mlContext.Transforms.ExtractPixels(outputColumnName: "input", interleavePixelColors: InceptionSettings.ChannelsLast, offsetImage: InceptionSettings.Mean)) // - // The ScoreTensorFlowModel transform scores the TensorFlow model and allows communication + // The ScoreTensorFlowModel transform scores the TensorFlow model and allows communication // .Append(mlContext.Model.LoadTensorFlowModel(_inceptionTensorFlowModel). ScoreTensorFlowModel(outputColumnNames: new[] { "softmax2_pre_activation" }, inputColumnNames: new[] { "input" }, addBatchDimensionInput: true)) @@ -87,7 +87,7 @@ public static ITransformer GenerateModel(MLContext mlContext) // Get performance metrics on the model using training data Console.WriteLine("=============== Classification metrics ==============="); - // + // MulticlassClassificationMetrics metrics = mlContext.MulticlassClassification.Evaluate(predictions, labelColumnName: "LabelKey", @@ -106,24 +106,24 @@ public static ITransformer GenerateModel(MLContext mlContext) public static void ClassifySingleImage(MLContext mlContext, ITransformer model) { - // load the fully qualified image file name into ImageData - // + // load the fully qualified image file name into ImageData + // var imageData = new ImageData() { ImagePath = _predictSingleImage }; - // + // - // + // // Make prediction function (input = ImageData, output = ImagePrediction) var predictor = mlContext.Model.CreatePredictionEngine(model); var prediction = predictor.Predict(imageData); - // + // Console.WriteLine("=============== Making single image classification ==============="); // Console.WriteLine($"Image: {Path.GetFileName(imageData.ImagePath)} predicted as: {prediction.PredictedLabelValue} with score: {prediction.Score.Max()} "); - // + // } private static void DisplayResults(IEnumerable imagePredictionData) @@ -138,7 +138,7 @@ private static void DisplayResults(IEnumerable imagePredictionD public static IEnumerable ReadFromTsv(string file, string folder) { - //Need to parse through the tags.tsv file to combine the file path to the + //Need to parse through the tags.tsv file to combine the file path to the // image name for the ImagePath property so that the image file can be found. // diff --git a/samples/snippets/standard/base-types/format-strings/biginteger-r.cs b/samples/snippets/standard/base-types/format-strings/biginteger-r.cs index 5015632e0e8fc..729ad2e9b79df 100644 --- a/samples/snippets/standard/base-types/format-strings/biginteger-r.cs +++ b/samples/snippets/standard/base-types/format-strings/biginteger-r.cs @@ -4,10 +4,10 @@ public class Example { public static void Main() - { + { var value = BigInteger.Pow(Int64.MaxValue, 2); Console.WriteLine(value.ToString("R")); } -} +} // The example displays the following output: -// 85070591730234615847396907784232501249 +// 85070591730234615847396907784232501249 diff --git a/samples/snippets/visualbasic/getting-started/ref-returns.cs b/samples/snippets/visualbasic/getting-started/ref-returns.cs index 64ae7ccbd7702..81d72df65e0eb 100644 --- a/samples/snippets/visualbasic/getting-started/ref-returns.cs +++ b/samples/snippets/visualbasic/getting-started/ref-returns.cs @@ -1,16 +1,16 @@ using System; - + public class Sentence { private string[] words; private int currentSearchPointer; - + public Sentence(string sentence) { words = sentence.Split(' '); currentSearchPointer = -1; } - + public ref string FindNext(string startWithString, ref bool found) { for (int count = currentSearchPointer + 1; count < words.Length; count++) @@ -26,13 +26,13 @@ public ref string FindNext(string startWithString, ref bool found) found = false; return ref words[0]; } - + public string GetSentence() { string stringToReturn = null; foreach (var word in words) stringToReturn += $"{word} "; - - return stringToReturn.Trim(); + + return stringToReturn.Trim(); } } From 22ed0ef88bad204c5c62ea62adb3c0401c5c1f32 Mon Sep 17 00:00:00 2001 From: Genevieve Warren Date: Fri, 17 Apr 2020 09:46:22 -0700 Subject: [PATCH 4/9] replace redirects (#17897) --- .../advanced/walkthrough-styling-wpf-content.md | 2 +- .../user-input-validation-in-windows-forms.md | 4 ++-- .../wpf/advanced/attached-properties-overview.md | 2 +- .../framework/wpf/advanced/base-elements-overview.md | 4 ++-- .../wpf/advanced/binding-markup-extension.md | 12 ++++++------ .../wpf/advanced/custom-dependency-properties.md | 2 +- .../wpf/advanced/dependency-properties-overview.md | 4 ++-- .../wpf/advanced/dynamicresource-markup-extension.md | 6 +++--- .../how-to-define-and-reference-a-resource.md | 4 ++-- .../optimizing-wpf-application-performance.md | 2 +- .../wpf/advanced/relativesource-markupextension.md | 4 ++-- docs/framework/wpf/advanced/resources-and-code.md | 4 ++-- .../wpf/advanced/staticresource-markup-extension.md | 4 ++-- .../wpf/advanced/templatebinding-markup-extension.md | 2 +- .../wpf/advanced/themedictionary-markup-extension.md | 2 +- docs/framework/wpf/advanced/toc.yml | 4 ++-- docs/framework/wpf/advanced/trees-in-wpf.md | 2 +- docs/framework/wpf/advanced/xaml-in-wpf.md | 2 +- docs/framework/wpf/advanced/xaml-syntax-in-detail.md | 2 +- .../wpf/controls/control-authoring-overview.md | 2 +- docs/framework/wpf/controls/datagrid.md | 2 +- ...edoubleclick-event-for-each-item-in-a-listview.md | 2 +- ...implement-validation-with-the-datagrid-control.md | 2 +- docs/framework/wpf/controls/index.md | 4 ++-- docs/framework/wpf/controls/toc.yml | 2 +- .../walkthrough-create-a-button-by-using-xaml.md | 4 ++-- docs/framework/wpf/data/data-templating-overview.md | 6 +++--- .../how-to-find-datatemplate-generated-elements.md | 2 +- docs/framework/wpf/data/index.md | 2 +- docs/framework/wpf/getting-started/index.md | 9 +++++---- .../walkthrough-my-first-wpf-desktop-application.md | 4 ++-- 31 files changed, 55 insertions(+), 54 deletions(-) diff --git a/docs/framework/winforms/advanced/walkthrough-styling-wpf-content.md b/docs/framework/winforms/advanced/walkthrough-styling-wpf-content.md index 1f1a8c64f9ab3..bc0560a96c498 100644 --- a/docs/framework/winforms/advanced/walkthrough-styling-wpf-content.md +++ b/docs/framework/winforms/advanced/walkthrough-styling-wpf-content.md @@ -135,5 +135,5 @@ You can apply different styling to a WPF control to change its appearance and be - [Migration and Interoperability](../../wpf/advanced/migration-and-interoperability.md) - [Using WPF Controls](using-wpf-controls.md) - [Design XAML in Visual Studio](/visualstudio/xaml-tools/designing-xaml-in-visual-studio) -- [XAML Overview (WPF)](../../wpf/advanced/xaml-overview-wpf.md) +- [XAML Overview (WPF)](../../../desktop-wpf/fundamentals/xaml.md) - [Styling and Templating](../../../desktop-wpf/fundamentals/styles-templates-overview.md) diff --git a/docs/framework/winforms/user-input-validation-in-windows-forms.md b/docs/framework/winforms/user-input-validation-in-windows-forms.md index 1aa56f3be7ff3..689fbc4cfc3a4 100644 --- a/docs/framework/winforms/user-input-validation-in-windows-forms.md +++ b/docs/framework/winforms/user-input-validation-in-windows-forms.md @@ -23,7 +23,7 @@ When users enter data into your application, you may want to verify that the dat - If the postal code must belong to a specific group of zip codes, you can perform a string comparison on the input to validate the data entered by the user. For example, if the postal code must be in the set {10001, 10002, 10003}, then you can use a string comparison to validate the data. -- If the postal code must be in a specific form you can use regular expressions to validate the data entered by the user. For example, to validate the form `#####` or `#####-####`, you can use the regular expression `^(\d{5})(-\d{4})?$`. To validate the form `A#A #A#`, you can use the regular expression `[A-Z]\d[A-Z] \d[A-Z]\d`. For more information about regular expressions, see [.NET Framework Regular Expressions](../../standard/base-types/regular-expressions.md) and [Regular Expression Examples](../../standard/base-types/regular-expression-examples.md). +- If the postal code must be in a specific form you can use regular expressions to validate the data entered by the user. For example, to validate the form `#####` or `#####-####`, you can use the regular expression `^(\d{5})(-\d{4})?$`. To validate the form `A#A #A#`, you can use the regular expression `[A-Z]\d[A-Z] \d[A-Z]\d`. For more information about regular expressions, see [.NET Framework Regular Expressions](../../standard/base-types/regular-expressions.md) and [Regular Expression Examples](../../standard/base-types/regular-expression-example-scanning-for-hrefs.md). - If the postal code must be a valid United States Zip code, you could call a Zip code Web service to validate the data entered by the user. @@ -90,4 +90,4 @@ When users enter data into your application, you may want to verify that the dat - - - [MaskedTextBox Control](./controls/maskedtextbox-control-windows-forms.md) -- [Regular Expression Examples](../../standard/base-types/regular-expression-examples.md) +- [Regular Expression Examples](../../standard/base-types/regular-expression-example-scanning-for-hrefs.md) diff --git a/docs/framework/wpf/advanced/attached-properties-overview.md b/docs/framework/wpf/advanced/attached-properties-overview.md index 4bff479093cfa..a117e4d0cfd36 100644 --- a/docs/framework/wpf/advanced/attached-properties-overview.md +++ b/docs/framework/wpf/advanced/attached-properties-overview.md @@ -30,7 +30,7 @@ The following is an example of how you can set that owns and registers the attached property, rather than referring to any instance specified by name. -Also, because an attached property in XAML is an attribute that you set in markup, only the set operation has any relevance. You cannot directly get a property in XAML, although there are some indirect mechanisms for comparing values, such as triggers in styles (for details, see [Styling and Templating](../controls/styling-and-templating.md)). +Also, because an attached property in XAML is an attribute that you set in markup, only the set operation has any relevance. You cannot directly get a property in XAML, although there are some indirect mechanisms for comparing values, such as triggers in styles (for details, see [Styling and Templating](../../../desktop-wpf/fundamentals/styles-templates-overview.md)). ### Attached Property Implementation in WPF diff --git a/docs/framework/wpf/advanced/base-elements-overview.md b/docs/framework/wpf/advanced/base-elements-overview.md index 86b90c62a980b..13214bcfa3321 100644 --- a/docs/framework/wpf/advanced/base-elements-overview.md +++ b/docs/framework/wpf/advanced/base-elements-overview.md @@ -41,7 +41,7 @@ A high percentage of classes in [!INCLUDE[TLA#tla_winclient](../../../../include - Support for styling and storyboards. For more information, see and [Storyboards Overview](../graphics-multimedia/storyboards-overview.md). -- Support for data binding. For more information, see [Data Binding Overview](../data/data-binding-overview.md). +- Support for data binding. For more information, see [Data Binding Overview](../../../desktop-wpf/data/data-binding-overview.md). - Support for dynamic resource references. For more information, see [XAML Resources](../../../desktop-wpf/fundamentals/xaml-resources-define.md). @@ -61,7 +61,7 @@ A high percentage of classes in [!INCLUDE[TLA#tla_winclient](../../../../include - Support for styling and storyboards. For more information, see and [Animation Overview](../graphics-multimedia/animation-overview.md). -- Support for data binding. For more information, see [Data Binding Overview](../data/data-binding-overview.md). +- Support for data binding. For more information, see [Data Binding Overview](../../../desktop-wpf/data/data-binding-overview.md). - Support for dynamic resource references. For more information, see [XAML Resources](../../../desktop-wpf/fundamentals/xaml-resources-define.md). diff --git a/docs/framework/wpf/advanced/binding-markup-extension.md b/docs/framework/wpf/advanced/binding-markup-extension.md index 7db3f5c4fa9e3..e05e8e48cbf06 100644 --- a/docs/framework/wpf/advanced/binding-markup-extension.md +++ b/docs/framework/wpf/advanced/binding-markup-extension.md @@ -38,7 +38,7 @@ Defers a property value to be a data-bound value, creating an intermediate expre |`path`|The path string that sets the implicit property. See also [PropertyPath XAML Syntax](propertypath-xaml-syntax.md).| ## Unqualified {Binding} - The `{Binding}` usage shown in "Binding Expression Usage" creates a object with default values, which includes an initial of `null`. This is still useful in many scenarios, because the created might be relying on key data binding properties such as and being set in the run-time data context. For more information on the concept of data context, see [Data Binding](../data/data-binding-wpf.md). + The `{Binding}` usage shown in "Binding Expression Usage" creates a object with default values, which includes an initial of `null`. This is still useful in many scenarios, because the created might be relying on key data binding properties such as and being set in the run-time data context. For more information on the concept of data context, see [Data Binding](../../../desktop-wpf/data/data-binding-overview.md). ## Implicit Path The `Binding` markup extension uses as a conceptual "default property", where `Path=` does not need to appear in the expression. If you specify a `Binding` expression with an implicit path, the implicit path must appear first in the expression, prior to any other `bindProp`=`value` pairs where the property is specified by name. For example: `{Binding PathString}`, where `PathString` is a string that is evaluated to be the value of in the created by the markup extension usage. You can append an implicit path with other named properties after the comma separator, for example, `{Binding LastName, Mode=TwoWay}`. @@ -58,7 +58,7 @@ Defers a property value to be a data-bound value, creating an intermediate expre - : can be set as a `bindProp`=`value` string in the expression, but this is dependent on the type of the parameter being passed. If passing a reference type for the value, this usage requires an object reference such as a nested [StaticResource Markup Extension](staticresource-markup-extension.md). -- : mutually exclusive versus and ; each of these binding properties represents a particular binding methodology. See [Data Binding Overview](../data/data-binding-overview.md). +- : mutually exclusive versus and ; each of these binding properties represents a particular binding methodology. See [Data Binding Overview](../../../desktop-wpf/data/data-binding-overview.md). - : can be set as a `bindProp`=`value` string in the expression, but this is dependent on the type of the value being passed. If passing a reference type, requires an object reference such as a nested [StaticResource Markup Extension](staticresource-markup-extension.md). @@ -74,9 +74,9 @@ Defers a property value to be a data-bound value, creating an intermediate expre - : a string that describes a path into a data object or a general object model. The format provides several different conventions for traversing an object model that cannot be adequately described in this topic. See [PropertyPath XAML Syntax](propertypath-xaml-syntax.md). -- : mutually exclusive versus with and ; each of these binding properties represents a particular binding methodology. See [Data Binding Overview](../data/data-binding-overview.md). Requires a nested [RelativeSource MarkupExtension](relativesource-markupextension.md) usage to specify the value. +- : mutually exclusive versus with and ; each of these binding properties represents a particular binding methodology. See [Data Binding Overview](../../../desktop-wpf/data/data-binding-overview.md). Requires a nested [RelativeSource MarkupExtension](relativesource-markupextension.md) usage to specify the value. -- : mutually exclusive versus and ; each of these binding properties represents a particular binding methodology. See [Data Binding Overview](../data/data-binding-overview.md). Requires a nested extension usage, typically a [StaticResource Markup Extension](staticresource-markup-extension.md) that refers to an object data source from a keyed resource dictionary. +- : mutually exclusive versus and ; each of these binding properties represents a particular binding methodology. See [Data Binding Overview](../../../desktop-wpf/data/data-binding-overview.md). Requires a nested extension usage, typically a [StaticResource Markup Extension](staticresource-markup-extension.md) that refers to an object data source from a keyed resource dictionary. - : a string that describes a string format convention for the bound data. This is a relatively advanced binding concept; see reference page for . @@ -103,7 +103,7 @@ Defers a property value to be a data-bound value, creating an intermediate expre > [!IMPORTANT] > In terms of dependency property precedence, a `Binding` expression is equivalent to a locally set value. If you set a local value for a property that previously had a `Binding` expression, the `Binding` is completely removed. For details, see [Dependency Property Value Precedence](dependency-property-value-precedence.md). - Describing data binding at a basic level is not covered in this topic. See [Data Binding Overview](../data/data-binding-overview.md). + Describing data binding at a basic level is not covered in this topic. See [Data Binding Overview](../../../desktop-wpf/data/data-binding-overview.md). > [!NOTE] > and do not support a [!INCLUDE[TLA2#tla_xaml](../../../../includes/tla2sharptla-xaml-md.md)] extension syntax. You would instead use property elements. See reference topics for and . @@ -119,6 +119,6 @@ Defers a property value to be a data-bound value, creating an intermediate expre ## See also - -- [Data Binding Overview](../data/data-binding-overview.md) +- [Data Binding Overview](../../../desktop-wpf/data/data-binding-overview.md) - [XAML Overview (WPF)](../../../desktop-wpf/fundamentals/xaml.md) - [Markup Extensions and WPF XAML](markup-extensions-and-wpf-xaml.md) diff --git a/docs/framework/wpf/advanced/custom-dependency-properties.md b/docs/framework/wpf/advanced/custom-dependency-properties.md index 4ebf0f537c1f8..14bad32d2d2ad 100644 --- a/docs/framework/wpf/advanced/custom-dependency-properties.md +++ b/docs/framework/wpf/advanced/custom-dependency-properties.md @@ -45,7 +45,7 @@ As mentioned in the [Dependency Properties Overview](dependency-properties-overv When you implement a property on a class, so long as your class derives from , you have the option to back your property with a identifier and thus to make it a dependency property. Having your property be a dependency property is not always necessary or appropriate, and will depend on your scenario needs. Sometimes, the typical technique of backing your property with a private field is adequate. However, you should implement your property as a dependency property whenever you want your property to support one or more of the following [!INCLUDE[TLA2#tla_winclient](../../../../includes/tla2sharptla-winclient-md.md)] capabilities: -- You want your property to be settable in a style. For more information, see [Styling and Templating](../controls/styling-and-templating.md). +- You want your property to be settable in a style. For more information, see [Styling and Templating](../../../desktop-wpf/fundamentals/styles-templates-overview.md). - You want your property to support data binding. For more information about data binding dependency properties, see [Bind the Properties of Two Controls](../data/how-to-bind-the-properties-of-two-controls.md). diff --git a/docs/framework/wpf/advanced/dependency-properties-overview.md b/docs/framework/wpf/advanced/dependency-properties-overview.md index 4a0863fd856b8..989c13984efcb 100644 --- a/docs/framework/wpf/advanced/dependency-properties-overview.md +++ b/docs/framework/wpf/advanced/dependency-properties-overview.md @@ -117,7 +117,7 @@ The following example sets the [!NOTE] > Bindings are treated as a local value, which means that if you set another local value, you will eliminate the binding. For details, see [Dependency Property Value Precedence](dependency-property-value-precedence.md). -Dependency properties, or the class, do not natively support for purposes of producing notifications of changes in source property value for data binding operations. For more information on how to create properties for use in data binding that can report changes to a data binding target, see [Data Binding Overview](../data/data-binding-overview.md). +Dependency properties, or the class, do not natively support for purposes of producing notifications of changes in source property value for data binding operations. For more information on how to create properties for use in data binding that can report changes to a data binding target, see [Data Binding Overview](../../../desktop-wpf/data/data-binding-overview.md). ### Styles Styles and templates are two of the chief motivating scenarios for using dependency properties. Styles are particularly useful for setting properties that define application [!INCLUDE[TLA#tla_ui](../../../../includes/tlasharptla-ui-md.md)]. Styles are typically defined as resources in XAML. Styles interact with the property system because they typically contain "setters" for particular properties, as well as "triggers" that change a property value based on the real-time value for another property. @@ -128,7 +128,7 @@ The following example creates a simple style (which would be defined inside a [!IMPORTANT] > In terms of dependency property precedence, a `DynamicResource` expression is equivalent to the position where the dynamic resource reference is applied. If you set a local value for a property that previously had a `DynamicResource` expression as the local value, the `DynamicResource` is completely removed. For details, see [Dependency Property Value Precedence](dependency-property-value-precedence.md). - Certain resource access scenarios are particularly appropriate for `DynamicResource` as opposed to a [StaticResource Markup Extension](staticresource-markup-extension.md). See [XAML Resources](xaml-resources.md) for a discussion about the relative merits and performance implications of `DynamicResource` and `StaticResource`. + Certain resource access scenarios are particularly appropriate for `DynamicResource` as opposed to a [StaticResource Markup Extension](staticresource-markup-extension.md). See [XAML Resources](../../../desktop-wpf/fundamentals/xaml-resources-define.md) for a discussion about the relative merits and performance implications of `DynamicResource` and `StaticResource`. - The specified should correspond to an existing resource determined by [x:Key Directive](../../../desktop-wpf/xaml-services/xkey-directive.md) at some level in your page, application, the available control themes and external resources, or system resources, and the resource lookup will happen in that order. For more information about resource lookup for static and dynamic resources, see [XAML Resources](xaml-resources.md). + The specified should correspond to an existing resource determined by [x:Key Directive](../../../desktop-wpf/xaml-services/xkey-directive.md) at some level in your page, application, the available control themes and external resources, or system resources, and the resource lookup will happen in that order. For more information about resource lookup for static and dynamic resources, see [XAML Resources](../../../desktop-wpf/fundamentals/xaml-resources-define.md). A resource key may be any string defined in the [XamlName Grammar](../../../desktop-wpf/xaml-services/xamlname-grammar.md). A resource key may also be other object types, such as a . A key is fundamental to how controls can be styled by themes. For more information, see [Control Authoring Overview](../controls/control-authoring-overview.md). @@ -68,7 +68,7 @@ Provides a value for any [!INCLUDE[TLA2#tla_xaml](../../../../includes/tla2sharp ## See also -- [XAML Resources](xaml-resources.md) +- [XAML Resources](../../../desktop-wpf/fundamentals/xaml-resources-define.md) - [Resources and Code](resources-and-code.md) - [x:Key Directive](../../../desktop-wpf/xaml-services/xkey-directive.md) - [XAML Overview (WPF)](../../../desktop-wpf/fundamentals/xaml.md) diff --git a/docs/framework/wpf/advanced/how-to-define-and-reference-a-resource.md b/docs/framework/wpf/advanced/how-to-define-and-reference-a-resource.md index adff222885911..6ecfeb4f7108b 100644 --- a/docs/framework/wpf/advanced/how-to-define-and-reference-a-resource.md +++ b/docs/framework/wpf/advanced/how-to-define-and-reference-a-resource.md @@ -17,11 +17,11 @@ This example shows how to define a resource and reference it by using an attribu The following example defines two types of resources: a resource, and several resources. The resource `MyBrush` is used to provide the value of several properties that each take a type value. The resources `PageBackground`, `TitleText` and `Label` each target a particular control type. The styles set a variety of different properties on the targeted controls, when that style resource is referenced by resource key and is used to set the property of several specific control elements defined in [!INCLUDE[TLA2#tla_xaml](../../../../includes/tla2sharptla-xaml-md.md)]. -Note that one of the properties within the setters of the `Label` style also references the `MyBrush` resource defined earlier. This is a common technique, but it is important to remember that resources are parsed and entered into a resource dictionary in the order that they are given. Resources are also requested by the order found within the dictionary if you use the [StaticResource Markup Extension](staticresource-markup-extension.md) to reference them from within another resource. Make sure that any resource that you reference is defined earlier within the resources collection than where that resource is then requested. If necessary, you can work around the strict creation order of resource references by using a [DynamicResource Markup Extension](dynamicresource-markup-extension.md) to reference the resource at runtime instead, but you should be aware that this DynamicResource technique has performance consequences. For details, see [XAML Resources](xaml-resources.md). +Note that one of the properties within the setters of the `Label` style also references the `MyBrush` resource defined earlier. This is a common technique, but it is important to remember that resources are parsed and entered into a resource dictionary in the order that they are given. Resources are also requested by the order found within the dictionary if you use the [StaticResource Markup Extension](staticresource-markup-extension.md) to reference them from within another resource. Make sure that any resource that you reference is defined earlier within the resources collection than where that resource is then requested. If necessary, you can work around the strict creation order of resource references by using a [DynamicResource Markup Extension](dynamicresource-markup-extension.md) to reference the resource at runtime instead, but you should be aware that this DynamicResource technique has performance consequences. For details, see [XAML Resources](../../../desktop-wpf/fundamentals/xaml-resources-define.md). [!code-xaml[FEResource#XAML](~/samples/snippets/csharp/VS_Snippets_Wpf/FEResource/CS/default.xaml#xaml)] ## See also -- [XAML Resources](xaml-resources.md) +- [XAML Resources](../../../desktop-wpf/fundamentals/xaml-resources-define.md) - [Styling and Templating](../../../desktop-wpf/fundamentals/styles-templates-overview.md) diff --git a/docs/framework/wpf/advanced/optimizing-wpf-application-performance.md b/docs/framework/wpf/advanced/optimizing-wpf-application-performance.md index 9a0758ea42d1d..798ec351bba58 100644 --- a/docs/framework/wpf/advanced/optimizing-wpf-application-performance.md +++ b/docs/framework/wpf/advanced/optimizing-wpf-application-performance.md @@ -49,7 +49,7 @@ This section is intended as a reference for [!INCLUDE[TLA#tla_winclient](../../. - [Using DrawingVisual Objects](../graphics-multimedia/using-drawingvisual-objects.md) - [Dependency Properties Overview](dependency-properties-overview.md) - [Freezable Objects Overview](freezable-objects-overview.md) -- [XAML Resources](xaml-resources.md) +- [XAML Resources](../../../desktop-wpf/fundamentals/xaml-resources-define.md) - [Documents in WPF](documents-in-wpf.md) - [Drawing Formatted Text](drawing-formatted-text.md) - [Typography in WPF](typography-in-wpf.md) diff --git a/docs/framework/wpf/advanced/relativesource-markupextension.md b/docs/framework/wpf/advanced/relativesource-markupextension.md index 44cd8aea1f88b..ec123a639fb74 100644 --- a/docs/framework/wpf/advanced/relativesource-markupextension.md +++ b/docs/framework/wpf/advanced/relativesource-markupextension.md @@ -107,8 +107,8 @@ In the [!INCLUDE[TLA2#tla_winclient](../../../../includes/tla2sharptla-winclient ## See also - -- [Styling and Templating](../controls/styling-and-templating.md) -- [XAML Overview (WPF)](xaml-overview-wpf.md) +- [Styling and Templating](../../../desktop-wpf/fundamentals/styles-templates-overview.md) +- [XAML Overview (WPF)](../../../desktop-wpf/fundamentals/xaml.md) - [Markup Extensions and WPF XAML](markup-extensions-and-wpf-xaml.md) - [Data Binding Overview](../../../desktop-wpf/data/data-binding-overview.md) - [Binding Declarations Overview](../data/binding-declarations-overview.md) diff --git a/docs/framework/wpf/advanced/resources-and-code.md b/docs/framework/wpf/advanced/resources-and-code.md index c5ce7a17172ab..82fae3b4caa25 100644 --- a/docs/framework/wpf/advanced/resources-and-code.md +++ b/docs/framework/wpf/advanced/resources-and-code.md @@ -13,7 +13,7 @@ helpviewer_keywords: ms.assetid: c1cfcddb-e39c-41c8-a7f3-60984914dfae --- # Resources and Code -This overview concentrates on how [!INCLUDE[TLA#tla_winclient](../../../../includes/tlasharptla-winclient-md.md)] resources can be accessed or created using code rather than [!INCLUDE[TLA#tla_xaml](../../../../includes/tlasharptla-xaml-md.md)] syntax. For more information on general resource usage and resources from a [!INCLUDE[TLA2#tla_xaml](../../../../includes/tla2sharptla-xaml-md.md)] syntax perspective, see [XAML Resources](xaml-resources.md). +This overview concentrates on how [!INCLUDE[TLA#tla_winclient](../../../../includes/tlasharptla-winclient-md.md)] resources can be accessed or created using code rather than [!INCLUDE[TLA#tla_xaml](../../../../includes/tlasharptla-xaml-md.md)] syntax. For more information on general resource usage and resources from a [!INCLUDE[TLA2#tla_xaml](../../../../includes/tla2sharptla-xaml-md.md)] syntax perspective, see [XAML Resources](../../../desktop-wpf/fundamentals/xaml-resources-define.md). ## Accessing Resources from Code @@ -40,5 +40,5 @@ This overview concentrates on how [!INCLUDE[TLA#tla_winclient](../../../../inclu ## See also -- [XAML Resources](xaml-resources.md) +- [XAML Resources](../../../desktop-wpf/fundamentals/xaml-resources-define.md) - [Styling and Templating](../../../desktop-wpf/fundamentals/styles-templates-overview.md) diff --git a/docs/framework/wpf/advanced/staticresource-markup-extension.md b/docs/framework/wpf/advanced/staticresource-markup-extension.md index deaf69d16f381..093d3b62b2418 100644 --- a/docs/framework/wpf/advanced/staticresource-markup-extension.md +++ b/docs/framework/wpf/advanced/staticresource-markup-extension.md @@ -63,8 +63,8 @@ Provides a value for any [!INCLUDE[TLA2#tla_xaml](../../../../includes/tla2sharp ## See also -- [Styling and Templating](../controls/styling-and-templating.md) -- [XAML Overview (WPF)](xaml-overview-wpf.md) +- [Styling and Templating](../../../desktop-wpf/fundamentals/styles-templates-overview.md) +- [XAML Overview (WPF)](../../../desktop-wpf/fundamentals/xaml.md) - [Markup Extensions and WPF XAML](markup-extensions-and-wpf-xaml.md) - [XAML Resources](../../../desktop-wpf/fundamentals/xaml-resources-define.md) - [Resources and Code](resources-and-code.md) diff --git a/docs/framework/wpf/advanced/templatebinding-markup-extension.md b/docs/framework/wpf/advanced/templatebinding-markup-extension.md index 34ae9fa053dec..248c519b00760 100644 --- a/docs/framework/wpf/advanced/templatebinding-markup-extension.md +++ b/docs/framework/wpf/advanced/templatebinding-markup-extension.md @@ -59,7 +59,7 @@ Links the value of a property in a control template to be the value of another p - - -- [Styling and Templating](../controls/styling-and-templating.md) +- [Styling and Templating](../../../desktop-wpf/fundamentals/styles-templates-overview.md) - [XAML Overview (WPF)](../../../desktop-wpf/fundamentals/xaml.md) - [Markup Extensions and WPF XAML](markup-extensions-and-wpf-xaml.md) - [RelativeSource MarkupExtension](relativesource-markupextension.md) diff --git a/docs/framework/wpf/advanced/themedictionary-markup-extension.md b/docs/framework/wpf/advanced/themedictionary-markup-extension.md index 4630ce69a5341..131d9dfd22252 100644 --- a/docs/framework/wpf/advanced/themedictionary-markup-extension.md +++ b/docs/framework/wpf/advanced/themedictionary-markup-extension.md @@ -59,7 +59,7 @@ Provides a way for custom control authors or applications that integrate third-p ## See also -- [Styling and Templating](../controls/styling-and-templating.md) +- [Styling and Templating](../../../desktop-wpf/fundamentals/styles-templates-overview.md) - [XAML Overview (WPF)](../../../desktop-wpf/fundamentals/xaml.md) - [Markup Extensions and WPF XAML](markup-extensions-and-wpf-xaml.md) - [WPF Application Resource, Content, and Data Files](../app-development/wpf-application-resource-content-and-data-files.md) diff --git a/docs/framework/wpf/advanced/toc.yml b/docs/framework/wpf/advanced/toc.yml index a3ec2d75cd912..e8f04b61053c0 100644 --- a/docs/framework/wpf/advanced/toc.yml +++ b/docs/framework/wpf/advanced/toc.yml @@ -7,7 +7,7 @@ href: xaml-in-wpf.md items: - name: XAML Overview (WPF) - href: xaml-overview-wpf.md + href: ../../../desktop-wpf/fundamentals/xaml.md - name: XAML Syntax In Detail href: xaml-syntax-in-detail.md - name: Code-Behind and XAML in WPF @@ -290,7 +290,7 @@ href: resources-wpf.md items: - name: XAML Resources - href: xaml-resources.md + href: ../../../desktop-wpf/fundamentals/xaml-resources-define.md items: - name: Resources and Code href: resources-and-code.md diff --git a/docs/framework/wpf/advanced/trees-in-wpf.md b/docs/framework/wpf/advanced/trees-in-wpf.md index a3dadc959c4bb..dac784ae3b85e 100644 --- a/docs/framework/wpf/advanced/trees-in-wpf.md +++ b/docs/framework/wpf/advanced/trees-in-wpf.md @@ -31,7 +31,7 @@ In many technologies, elements and components are organized in a tree structure However, the logical tree is not the entire object graph that exists for your application UI at run time, even with the XAML implicit syntax items factored out. The main reason for this is visuals and templates. For example, consider the . The logical tree reports the object and also its string `Content`. But there is more to this button in the run-time object tree. In particular, the button only appears on screen the way it does because a specific control template was applied. The visuals that come from an applied template (such as the template-defined of dark gray around the visual button) are not reported in the logical tree, even if you are looking at the logical tree during run time (such as handling an input event from the visible UI and then reading the logical tree). To find the template visuals, you would instead need to examine the visual tree. - For more information about how [!INCLUDE[TLA2#tla_xaml](../../../../includes/tla2sharptla-xaml-md.md)] syntax maps to the created object graph, and implicit syntax in XAML, see [XAML Syntax In Detail](xaml-syntax-in-detail.md) or [XAML Overview (WPF)](xaml-overview-wpf.md). + For more information about how [!INCLUDE[TLA2#tla_xaml](../../../../includes/tla2sharptla-xaml-md.md)] syntax maps to the created object graph, and implicit syntax in XAML, see [XAML Syntax In Detail](xaml-syntax-in-detail.md) or [XAML Overview (WPF)](../../../desktop-wpf/fundamentals/xaml.md). ### The Purpose of the Logical Tree diff --git a/docs/framework/wpf/advanced/xaml-in-wpf.md b/docs/framework/wpf/advanced/xaml-in-wpf.md index 62cdf79d271e9..920f88db1dad6 100644 --- a/docs/framework/wpf/advanced/xaml-in-wpf.md +++ b/docs/framework/wpf/advanced/xaml-in-wpf.md @@ -14,7 +14,7 @@ ms.assetid: 5d858575-a83b-42df-ad3f-047ed2d6e3c8 ## In This Section -[XAML Overview (WPF)](xaml-overview-wpf.md) +[XAML Overview (WPF)](../../../desktop-wpf/fundamentals/xaml.md) [XAML Syntax In Detail](xaml-syntax-in-detail.md) [Code-Behind and XAML in WPF](code-behind-and-xaml-in-wpf.md) [XAML and Custom Classes for WPF](xaml-and-custom-classes-for-wpf.md) diff --git a/docs/framework/wpf/advanced/xaml-syntax-in-detail.md b/docs/framework/wpf/advanced/xaml-syntax-in-detail.md index cc8af25d53970..4713c159cd1dd 100644 --- a/docs/framework/wpf/advanced/xaml-syntax-in-detail.md +++ b/docs/framework/wpf/advanced/xaml-syntax-in-detail.md @@ -124,7 +124,7 @@ This topic defines the terms that are used to describe the elements of XAML synt You can also name any event from any object that is accessible through the default namespace by using a *typeName*.*event* partially qualified name; this syntax supports attaching handlers for routed events where the handler is intended to handle events routing from child elements, but the parent element does not also have that event in its members table. This syntax resembles an attached event syntax, but the event here is not a true attached event. Instead, you are referencing an event with a qualified name. For more information, see [Routed Events Overview](routed-events-overview.md). - For some scenarios, property names are sometimes provided as the value of an attribute, rather than the attribute name. That property name can also include qualifiers, such as the property specified in the form *ownerType*.*dependencyPropertyName*. This scenario is common when writing styles or templates in XAML. The processing rules for property names provided as an attribute value are different, and are governed by the type of the property being set or by the behaviors of particular WPF subsystems. For details, see [Styling and Templating](../controls/styling-and-templating.md). + For some scenarios, property names are sometimes provided as the value of an attribute, rather than the attribute name. That property name can also include qualifiers, such as the property specified in the form *ownerType*.*dependencyPropertyName*. This scenario is common when writing styles or templates in XAML. The processing rules for property names provided as an attribute value are different, and are governed by the type of the property being set or by the behaviors of particular WPF subsystems. For details, see [Styling and Templating](../../../desktop-wpf/fundamentals/styles-templates-overview.md). Another usage for property names is when an attribute value describes a property-property relationship. This feature is used for data binding and for storyboard targets, and is enabled by the class and its type converter. For a more complete description of the lookup semantics, see [PropertyPath XAML Syntax](propertypath-xaml-syntax.md). diff --git a/docs/framework/wpf/controls/control-authoring-overview.md b/docs/framework/wpf/controls/control-authoring-overview.md index 89a4abccbdeaf..116ff85cb5d4e 100644 --- a/docs/framework/wpf/controls/control-authoring-overview.md +++ b/docs/framework/wpf/controls/control-authoring-overview.md @@ -32,7 +32,7 @@ Historically, if you wanted to get a customized experience from an existing cont - **Triggers.** A allows you to dynamically change the appearance and behavior of a control without creating a new control. For example, suppose you have multiple controls in your application and want the items in each to be bold and red when they are selected. Your first instinct might be to create a class that inherits from and override the method to change the appearance of the selected item, but a better approach is to add a trigger to a style of a that changes the appearance of the selected item. A trigger enables you to change property values or take actions based on the value of a property. An enables you to take actions when an event occurs. -For more information about styles, templates, and triggers, see [Styling and Templating](styling-and-templating.md). +For more information about styles, templates, and triggers, see [Styling and Templating](../../../desktop-wpf/fundamentals/styles-templates-overview.md). In general, if your control mirrors the functionality of an existing control, but you want the control to look different, you should first consider whether you can use any of the methods discussed in this section to change the existing control's appearance. diff --git a/docs/framework/wpf/controls/datagrid.md b/docs/framework/wpf/controls/datagrid.md index ef005c1b78997..346549f177bd2 100644 --- a/docs/framework/wpf/controls/datagrid.md +++ b/docs/framework/wpf/controls/datagrid.md @@ -53,7 +53,7 @@ The control enables you to display and e ## See also - -- [Styling and Templating](styling-and-templating.md) +- [Styling and Templating](../../../desktop-wpf/fundamentals/styles-templates-overview.md) - [Data Binding Overview](../../../desktop-wpf/data/data-binding-overview.md) - [Data Templating Overview](../data/data-templating-overview.md) - [Controls](index.md) diff --git a/docs/framework/wpf/controls/how-to-handle-the-mousedoubleclick-event-for-each-item-in-a-listview.md b/docs/framework/wpf/controls/how-to-handle-the-mousedoubleclick-event-for-each-item-in-a-listview.md index c8603a62e5f57..82d30ca0caa93 100644 --- a/docs/framework/wpf/controls/how-to-handle-the-mousedoubleclick-event-for-each-item-in-a-listview.md +++ b/docs/framework/wpf/controls/how-to-handle-the-mousedoubleclick-event-for-each-item-in-a-listview.md @@ -29,7 +29,7 @@ To handle an event for an item in a , you ## See also - -- [Data Binding Overview](../data/data-binding-overview.md) +- [Data Binding Overview](../../../desktop-wpf/data/data-binding-overview.md) - [Styling and Templating](../../../desktop-wpf/fundamentals/styles-templates-overview.md) - [Bind to XML Data Using an XMLDataProvider and XPath Queries](../data/how-to-bind-to-xml-data-using-an-xmldataprovider-and-xpath-queries.md) - [ListView Overview](listview-overview.md) diff --git a/docs/framework/wpf/controls/how-to-implement-validation-with-the-datagrid-control.md b/docs/framework/wpf/controls/how-to-implement-validation-with-the-datagrid-control.md index d85dd79d0a822..1bdad4ed4fc50 100644 --- a/docs/framework/wpf/controls/how-to-implement-validation-with-the-datagrid-control.md +++ b/docs/framework/wpf/controls/how-to-implement-validation-with-the-datagrid-control.md @@ -16,7 +16,7 @@ The control enables you to perform valid ### To validate individual cell values -- Specify one or more validation rules on the binding used with a column. This is similar to validating data in simple controls, as described in [Data Binding Overview](../data/data-binding-overview.md). +- Specify one or more validation rules on the binding used with a column. This is similar to validating data in simple controls, as described in [Data Binding Overview](../../../desktop-wpf/data/data-binding-overview.md). The following example shows a control with four columns bound to different properties of a business object. Three of the columns specify the by setting the property to `true`. diff --git a/docs/framework/wpf/controls/index.md b/docs/framework/wpf/controls/index.md index 8d622b7226271..b5b61064ab02b 100644 --- a/docs/framework/wpf/controls/index.md +++ b/docs/framework/wpf/controls/index.md @@ -48,7 +48,7 @@ ms.assetid: 3f255a8a-35a8-4712-9065-472ff7d75599 [!code-xaml[ControlsOverview#5](~/samples/snippets/csharp/VS_Snippets_Wpf/ControlsOverview/CSharp/AppInCode.xaml#5)] - You can also apply a style to only certain controls of a specific type by assigning a key to the style and specifying that key in the `Style` property of your control. For more information about styles, see [Styling and Templating](styling-and-templating.md). + You can also apply a style to only certain controls of a specific type by assigning a key to the style and specifying that key in the `Style` property of your control. For more information about styles, see [Styling and Templating](../../../desktop-wpf/fundamentals/styles-templates-overview.md). ### Creating a ControlTemplate A allows you to set properties on multiple controls at a time, but sometimes you might want to customize the appearance of a beyond what you can do by creating a . Classes that inherit from the class have a , which defines the structure and appearance of a . The property of a is public, so you can give a a that is different than its default. You can often specify a new for a instead of inheriting from a control to customize the appearance of a . @@ -93,7 +93,7 @@ ms.assetid: 3f255a8a-35a8-4712-9065-472ff7d75599 ## See also -- [Styling and Templating](styling-and-templating.md) +- [Styling and Templating](../../../desktop-wpf/fundamentals/styles-templates-overview.md) - [Controls by Category](controls-by-category.md) - [Control Library](control-library.md) - [Data Templating Overview](../data/data-templating-overview.md) diff --git a/docs/framework/wpf/controls/toc.yml b/docs/framework/wpf/controls/toc.yml index 5c80051556377..18d1a9bb61aaa 100644 --- a/docs/framework/wpf/controls/toc.yml +++ b/docs/framework/wpf/controls/toc.yml @@ -393,7 +393,7 @@ href: styles-and-templates.md items: - name: Styling and Templating - href: styling-and-templating.md + href: ../../../desktop-wpf/fundamentals/styles-templates-overview.md - name: Customizing an Existing Control with a ControlTemplate href: ../../../desktop-wpf/themes/how-to-create-apply-template.md - name: "How to: Find ControlTemplate-Generated Elements" diff --git a/docs/framework/wpf/controls/walkthrough-create-a-button-by-using-xaml.md b/docs/framework/wpf/controls/walkthrough-create-a-button-by-using-xaml.md index 8f9eb301e219b..ba313a2ca3cce 100644 --- a/docs/framework/wpf/controls/walkthrough-create-a-button-by-using-xaml.md +++ b/docs/framework/wpf/controls/walkthrough-create-a-button-by-using-xaml.md @@ -51,7 +51,7 @@ Let's start by creating a new project and adding a few buttons to the window. ## Set Basic Properties -Next, let's set some properties on these buttons to control the button appearance and layout. Rather than setting properties on the buttons individually, you will use resources to define button properties for the entire application. Application resources are conceptually similar to external Cascading Style Sheets (CSS) for Web pages; however, resources are much more powerful than Cascading Style Sheets (CSS), as you will see by the end of this walkthrough. To learn more about resources, see [XAML Resources](../advanced/xaml-resources.md). +Next, let's set some properties on these buttons to control the button appearance and layout. Rather than setting properties on the buttons individually, you will use resources to define button properties for the entire application. Application resources are conceptually similar to external Cascading Style Sheets (CSS) for Web pages; however, resources are much more powerful than Cascading Style Sheets (CSS), as you will see by the end of this walkthrough. To learn more about resources, see [XAML Resources](../../../desktop-wpf/fundamentals/xaml-resources-define.md). ### To use styles to set basic properties on the buttons @@ -69,7 +69,7 @@ Next, let's set some properties on these buttons to control the button appearanc ``` - Resource scope is determined by where you define the resource. Defining resources in `Application.Resources` in the app.xaml file enables the resource to be used from anywhere in the application. To learn more about defining the scope of your resources, see [XAML Resources](../advanced/xaml-resources.md). + Resource scope is determined by where you define the resource. Defining resources in `Application.Resources` in the app.xaml file enables the resource to be used from anywhere in the application. To learn more about defining the scope of your resources, see [XAML Resources](../../../desktop-wpf/fundamentals/xaml-resources-define.md). 2. **Create a style and define basic property values with it:** Add the following markup to the `Application.Resources` block. This markup creates a that applies to all buttons in the application, setting the of the buttons to 90 and the to 10: diff --git a/docs/framework/wpf/data/data-templating-overview.md b/docs/framework/wpf/data/data-templating-overview.md index 05bbe8ba9f0c1..b6454648ead49 100644 --- a/docs/framework/wpf/data/data-templating-overview.md +++ b/docs/framework/wpf/data/data-templating-overview.md @@ -18,9 +18,9 @@ The WPF data templating model provides you with great flexibility to define the ## Prerequisites This topic focuses on data templating features and is not an introduction of data binding concepts. For information about basic data binding concepts, see the [Data Binding Overview](../../../desktop-wpf/data/data-binding-overview.md). - is about the presentation of data and is one of the many features provided by the WPF styling and templating model. For an introduction of the WPF styling and templating model, such as how to use a to set properties on controls, see the [Styling and Templating](../controls/styling-and-templating.md) topic. + is about the presentation of data and is one of the many features provided by the WPF styling and templating model. For an introduction of the WPF styling and templating model, such as how to use a to set properties on controls, see the [Styling and Templating](../../../desktop-wpf/fundamentals/styles-templates-overview.md) topic. - In addition, it is important to understand `Resources`, which are essentially what enable objects such as and to be reusable. For more information on resources, see [XAML Resources](../advanced/xaml-resources.md). + In addition, it is important to understand `Resources`, which are essentially what enable objects such as and to be reusable. For more information on resources, see [XAML Resources](../../../desktop-wpf/fundamentals/xaml-resources-define.md). ## Data Templating Basics @@ -191,6 +191,6 @@ This concludes our discussion of this example. For the complete sample, see [Int - [Data Binding](../advanced/optimizing-performance-data-binding.md) - [Find DataTemplate-Generated Elements](how-to-find-datatemplate-generated-elements.md) -- [Styling and Templating](../controls/styling-and-templating.md) +- [Styling and Templating](../../../desktop-wpf/fundamentals/styles-templates-overview.md) - [Data Binding Overview](../../../desktop-wpf/data/data-binding-overview.md) - [GridView Column Header Styles and Templates Overview](../controls/gridview-column-header-styles-and-templates-overview.md) diff --git a/docs/framework/wpf/data/how-to-find-datatemplate-generated-elements.md b/docs/framework/wpf/data/how-to-find-datatemplate-generated-elements.md index c359e58282b6a..7e399bad37ea7 100644 --- a/docs/framework/wpf/data/how-to-find-datatemplate-generated-elements.md +++ b/docs/framework/wpf/data/how-to-find-datatemplate-generated-elements.md @@ -34,7 +34,7 @@ This example shows how to find elements that are generated by a
[.NET Framework Application Essentials](../../../standard/application-essentials.md)

[Getting Started with Visual C# and Visual Basic](/visualstudio/ide/quickstart-visual-basic-console)| -|Tell me more about WPF…|[Introduction to WPF in Visual Studio](introduction-to-wpf-in-vs.md)

[XAML Overview (WPF)](../advanced/xaml-overview-wpf.md)

[Controls](../controls/index.md)

[Data Binding Overview](../../../desktop-wpf/data/data-binding-overview.md)| +|New to .NET?|[Overview of the .NET Framework](../../get-started/overview.md)

[Getting Started with Visual C# and Visual Basic](/visualstudio/ide/quickstart-visual-basic-console)| +|Tell me more about WPF…|[Introduction to WPF in Visual Studio](introduction-to-wpf-in-vs.md)

[XAML Overview (WPF)](../../../desktop-wpf/fundamentals/xaml.md)

[Controls](../controls/index.md)

[Data Binding Overview](../../../desktop-wpf/data/data-binding-overview.md)| |Are you a Windows Forms developer?|[Windows Forms Controls and Equivalent WPF Controls](../advanced/windows-forms-controls-and-equivalent-wpf-controls.md)

[WPF and Windows Forms Interoperation](../advanced/wpf-and-windows-forms-interoperation.md)| ## See also diff --git a/docs/framework/wpf/getting-started/walkthrough-my-first-wpf-desktop-application.md b/docs/framework/wpf/getting-started/walkthrough-my-first-wpf-desktop-application.md index fc412046065a8..8bf57b1fc8156 100644 --- a/docs/framework/wpf/getting-started/walkthrough-my-first-wpf-desktop-application.md +++ b/docs/framework/wpf/getting-started/walkthrough-my-first-wpf-desktop-application.md @@ -352,7 +352,7 @@ The following illustration shows the UI elements added to *ExpenseReportPage.xam ## Style controls -The appearance of various elements is often the same for all elements of the same type in a UI. UI uses [styles](../controls/styling-and-templating.md) to make appearances reusable across multiple elements. The reusability of styles helps to simplify XAML creation and management. This section replaces the per-element attributes that were defined in previous steps with styles. +The appearance of various elements is often the same for all elements of the same type in a UI. UI uses [styles](../../../desktop-wpf/fundamentals/styles-templates-overview.md) to make appearances reusable across multiple elements. The reusability of styles helps to simplify XAML creation and management. This section replaces the per-element attributes that were defined in previous steps with styles. 1. Open *Application.xaml* or *App.xaml*. @@ -475,7 +475,7 @@ The following illustration shows both pages of the `ExpenseIt` application with In this walkthrough you learned a number of techniques for creating a UI using Windows Presentation Foundation (WPF). You should now have a basic understanding of the building blocks of a data-bound .NET app. For more information about the WPF architecture and programming models, see the following topics: - [WPF architecture](../advanced/wpf-architecture.md) -- [XAML overview (WPF)](../advanced/xaml-overview-wpf.md) +- [XAML overview (WPF)](../../../desktop-wpf/fundamentals/xaml.md) - [Dependency properties overview](../advanced/dependency-properties-overview.md) - [Layout](../advanced/layout.md) From 35d7f29dcc078edabadd1440333ba8191efa4337 Mon Sep 17 00:00:00 2001 From: Genevieve Warren Date: Fri, 17 Apr 2020 11:06:47 -0700 Subject: [PATCH 5/9] Replace redirects (#17900) * replace redirects Co-authored-by: Andy De George <2672110+Thraka@users.noreply.github.com> --- docs/core/diagnostics/debug-memory-leak.md | 2 +- docs/core/introduction.md | 2 +- docs/core/toc.yml | 4 ++-- docs/core/versions/index.md | 2 +- docs/core/whats-new/dotnet-core-2-1.md | 2 +- docs/core/whats-new/dotnet-core-2-2.md | 2 +- docs/framework/app-domains/build-single-file-assembly.md | 2 +- .../how-to-share-an-assembly-with-other-applications.md | 2 +- docs/framework/app-domains/index.md | 2 +- docs/framework/app-domains/multifile-assemblies.md | 2 +- .../running-intranet-applications-in-full-trust.md | 2 +- docs/framework/app-domains/use.md | 2 +- .../app-domains/working-with-assemblies-and-the-gac.md | 2 +- .../runtime/generatepublisherevidence-element.md | 2 +- .../sessionsecuritytokencache.md | 2 +- .../configure-apps/how-to-create-a-publisher-policy.md | 2 +- .../framework/configure-apps/redirect-assembly-versions.md | 2 +- docs/framework/configure-apps/specify-assembly-location.md | 2 +- docs/framework/data/adonet/code-access-security.md | 2 +- docs/framework/data/adonet/ef/terminology.md | 6 +++--- docs/framework/development-guide.md | 7 +++---- .../mitigation-ziparchiveentry-fullname-path-separator.md | 1 - docs/framework/misc/code-access-security-basics.md | 2 +- docs/framework/misc/code-access-security.md | 2 +- .../dangerous-permissions-and-policy-administration.md | 2 +- docs/framework/misc/security-transparent-code-level-1.md | 2 +- docs/framework/misc/security-transparent-code-level-2.md | 2 +- .../misc/using-libraries-from-partially-trusted-code.md | 2 +- .../etw-events-in-task-parallel-library-and-plinq.md | 2 +- docs/framework/performance/etw-events.md | 4 ++-- .../security-considerations-for-reflection.md | 4 ++-- .../security-issues-in-reflection-emit.md | 4 ++-- docs/framework/resources/index.md | 1 - docs/framework/tools/al-exe-assembly-linker.md | 2 +- .../tools/caspol-exe-code-access-security-policy-tool.md | 6 +++--- docs/framework/tools/index.md | 2 +- docs/framework/whats-new/index.md | 6 +++--- .../windows-workflow-foundation/workflow-security.md | 2 +- docs/standard/io/types-of-isolation.md | 2 +- .../system-text-json-migrate-from-newtonsoft-how-to.md | 2 +- docs/welcome.md | 4 ++-- docs/whats-new/2019-10.md | 2 +- docs/whats-new/dotnet-2020-03.md | 2 +- 43 files changed, 54 insertions(+), 57 deletions(-) diff --git a/docs/core/diagnostics/debug-memory-leak.md b/docs/core/diagnostics/debug-memory-leak.md index ac6bb6ceedde4..222be6cb470fa 100644 --- a/docs/core/diagnostics/debug-memory-leak.md +++ b/docs/core/diagnostics/debug-memory-leak.md @@ -140,7 +140,7 @@ dotnet-dump analyze core_20190430_185145 Where `core_20190430_185145` is the name of the core dump you want to analyze. > [!NOTE] -> If you see an error complaining that *libdl.so* cannot be found, you may have to install the *libc6-dev* package. For more information, see [Prerequisites for .NET Core on Linux](../linux-prerequisites.md). +> If you see an error complaining that *libdl.so* cannot be found, you may have to install the *libc6-dev* package. For more information, see [Prerequisites for .NET Core on Linux](../install/dependencies.md?pivots=os-linux). You'll be presented with a prompt where you can enter SOS commands. Commonly, the first thing you want to look at is the overall state of the managed heap: diff --git a/docs/core/introduction.md b/docs/core/introduction.md index 85252c5df5f20..709a5054f913a 100644 --- a/docs/core/introduction.md +++ b/docs/core/introduction.md @@ -7,7 +7,7 @@ ms.custom: "updateeachrelease" --- # Introduction to .NET Core -[.NET Core](about.md) is an [open-source](https://github.com/dotnet/runtime/blob/master/LICENSE.TXT), general-purpose development platform. You can create .NET Core apps for Windows, macOS, and Linux for x64, x86, ARM32, and ARM64 processors using multiple programming languages. Frameworks and APIs are provided for [cloud](/aspnet/core/), [IoT](/archive/msdn-magazine/2019/august/net-core-cross-platform-iot-programming-with-net-core-3-0), [client UI](/dotnet/desktop-wpf/overview/index), and [machine learning](/dotnet/machine-learning/). +[.NET Core](about.md) is an [open-source](https://github.com/dotnet/runtime/blob/master/LICENSE.TXT), general-purpose development platform. You can create .NET Core apps for Windows, macOS, and Linux for x64, x86, ARM32, and ARM64 processors using multiple programming languages. Frameworks and APIs are provided for [cloud](/aspnet/core/), [IoT](/archive/msdn-magazine/2019/august/net-core-cross-platform-iot-programming-with-net-core-3-0), [client UI](../desktop-wpf/overview/index.md), and [machine learning](/dotnet/machine-learning/). [Download the .NET Core SDK](https://dotnet.microsoft.com/download) to try .NET Core on your machine. The latest version is [.NET Core 3.1](https://devblogs.microsoft.com/dotnet/announcing-net-core-3-1/). diff --git a/docs/core/toc.yml b/docs/core/toc.yml index 2aafa650e1732..0a7aa4bc8359f 100644 --- a/docs/core/toc.yml +++ b/docs/core/toc.yml @@ -351,7 +351,7 @@ - name: Port Windows Forms projects href: porting/winforms.md - name: Port WPF projects - href: porting/wpf.md + href: ../desktop-wpf/migration/convert-project-from-net-framework.md - name: Port C++/CLI projects href: porting/cpp-cli.md - name: Unit testing @@ -418,7 +418,7 @@ - name: Create a .NET Core application with plugins href: tutorials/creating-app-with-plugin-support.md - name: How to use and debug assembly unloadability in .NET Core - href: ../standard/assembly/unloadability-howto.md + href: ../standard/assembly/unloadability.md - name: .NET Core distribution packaging href: distribution-packaging.md - name: Expose .NET Core components to COM diff --git a/docs/core/versions/index.md b/docs/core/versions/index.md index 0387e36ac285d..b296e3cad4ce3 100644 --- a/docs/core/versions/index.md +++ b/docs/core/versions/index.md @@ -102,7 +102,7 @@ Each version of .NET Core implements a version of .NET Standard. Implementing a ## See also - [Target frameworks](../../standard/frameworks.md) -- [.NET Core distribution packaging](../build/distribution-packaging.md) +- [.NET Core distribution packaging](../distribution-packaging.md) - [.NET Core Support Lifecycle Fact Sheet](https://dotnet.microsoft.com/platform/support/policy) - [.NET Core 2+ Version Binding](https://github.com/dotnet/designs/issues/3) - [Docker images for .NET Core](https://hub.docker.com/_/microsoft-dotnet-core/) diff --git a/docs/core/whats-new/dotnet-core-2-1.md b/docs/core/whats-new/dotnet-core-2-1.md index 80db36f71cc3f..027860056449d 100644 --- a/docs/core/whats-new/dotnet-core-2-1.md +++ b/docs/core/whats-new/dotnet-core-2-1.md @@ -245,6 +245,6 @@ For information about breaking changes, see [Breaking changes for migration from ## See also -- [What's new in .NET Core](index.md) +- [What's new in .NET Core 3.1](dotnet-core-3-1.md) - [New features in EF Core 2.1](/ef/core/what-is-new/ef-core-2.1) - [What's new in ASP.NET Core 2.1](/aspnet/core/aspnetcore-2.1) diff --git a/docs/core/whats-new/dotnet-core-2-2.md b/docs/core/whats-new/dotnet-core-2-2.md index c1805df1b36be..1070d13a547b0 100644 --- a/docs/core/whats-new/dotnet-core-2-2.md +++ b/docs/core/whats-new/dotnet-core-2-2.md @@ -91,6 +91,6 @@ See [Host startup hook](https://github.com/dotnet/core-setup/blob/master/Documen ## See also -- [What's new in .NET Core](index.md) +- [What's new in .NET Core 3.1](dotnet-core-3-1.md) - [What's new in ASP.NET Core 2.2](/aspnet/core/release-notes/aspnetcore-2.2) - [New features in EF Core 2.2](/ef/core/what-is-new/ef-core-2.2) diff --git a/docs/framework/app-domains/build-single-file-assembly.md b/docs/framework/app-domains/build-single-file-assembly.md index c683fa40c300b..f1b8ca194d5ea 100644 --- a/docs/framework/app-domains/build-single-file-assembly.md +++ b/docs/framework/app-domains/build-single-file-assembly.md @@ -83,4 +83,4 @@ vbc -out:myCodeLibrary.dll -t:library myCode.vb - [Create assemblies](../../standard/assembly/create.md) - [Multifile assemblies](multifile-assemblies.md) - [How to: Build a multifile assembly](build-multifile-assembly.md) -- [Program with assemblies](../../standard/assembly/program.md) +- [Program with assemblies](../../standard/assembly/index.md) diff --git a/docs/framework/app-domains/how-to-share-an-assembly-with-other-applications.md b/docs/framework/app-domains/how-to-share-an-assembly-with-other-applications.md index ba6097d5448bb..c4a42c26833c3 100644 --- a/docs/framework/app-domains/how-to-share-an-assembly-with-other-applications.md +++ b/docs/framework/app-domains/how-to-share-an-assembly-with-other-applications.md @@ -24,4 +24,4 @@ To share an assembly: - [C# programming guide](../../../api/index.md) - [Programming concepts (Visual Basic)](../../../api/index.md) -- [Program with assemblies](../../standard/assembly/program.md) +- [Program with assemblies](../../standard/assembly/index.md) diff --git a/docs/framework/app-domains/index.md b/docs/framework/app-domains/index.md index 97f0b59d0ff3d..eaef3e70f16e3 100644 --- a/docs/framework/app-domains/index.md +++ b/docs/framework/app-domains/index.md @@ -22,7 +22,7 @@ Provides links to all How-to topics found in the conceptual documentation for pr [Using Application Domains](use.md) Provides examples of creating, configuring, and using application domains. -[Programming with Assemblies](../../standard/assembly/program.md) +[Programming with Assemblies](../../standard/assembly/index.md) Describes how to create, sign, and set attributes on assemblies. ## Related Sections diff --git a/docs/framework/app-domains/multifile-assemblies.md b/docs/framework/app-domains/multifile-assemblies.md index ebd5cbd605cea..9175ec74ed7ab 100644 --- a/docs/framework/app-domains/multifile-assemblies.md +++ b/docs/framework/app-domains/multifile-assemblies.md @@ -36,4 +36,4 @@ Once you create the assembly, you can sign the file that contains the assembly m ## See also - [How to: Build a multifile assembly](build-multifile-assembly.md) -- [Program with assemblies](../../standard/assembly/program.md) +- [Program with assemblies](../../standard/assembly/index.md) diff --git a/docs/framework/app-domains/running-intranet-applications-in-full-trust.md b/docs/framework/app-domains/running-intranet-applications-in-full-trust.md index 35790e71a7423..69cdc3eb3e7fd 100644 --- a/docs/framework/app-domains/running-intranet-applications-in-full-trust.md +++ b/docs/framework/app-domains/running-intranet-applications-in-full-trust.md @@ -31,4 +31,4 @@ This new behavior is the default for intranet assemblies. You can return to the ## See also -- [Programming with Assemblies](../../standard/assembly/program.md) +- [Programming with Assemblies](../../standard/assembly/index.md) diff --git a/docs/framework/app-domains/use.md b/docs/framework/app-domains/use.md index ab1c76e87ed53..15d1d3f07a7a6 100644 --- a/docs/framework/app-domains/use.md +++ b/docs/framework/app-domains/use.md @@ -51,7 +51,7 @@ Represents an application domain. Provides methods for creating and controlling [Assemblies in .NET](../../standard/assembly/index.md) Provides an overview of the functions performed by assemblies. -[Programming with Assemblies](../../standard/assembly/program.md) +[Programming with Assemblies](../../standard/assembly/index.md) Describes how to create, sign, and set attributes on assemblies. [Emitting Dynamic Methods and Assemblies](../reflection-and-codedom/emitting-dynamic-methods-and-assemblies.md) diff --git a/docs/framework/app-domains/working-with-assemblies-and-the-gac.md b/docs/framework/app-domains/working-with-assemblies-and-the-gac.md index 2bbb3ebe9d79f..c3658097b189a 100644 --- a/docs/framework/app-domains/working-with-assemblies-and-the-gac.md +++ b/docs/framework/app-domains/working-with-assemblies-and-the-gac.md @@ -65,5 +65,5 @@ Explains how to use the [Ildasm.exe (IL Disassembler)](../tools/ildasm-exe-il-di [How the Runtime Locates Assemblies](../deployment/how-the-runtime-locates-assemblies.md) Describes how the common language runtime locates and loads the assemblies that make up your application. -[Programming with Assemblies](../../standard/assembly/program.md) +[Programming with Assemblies](../../standard/assembly/index.md) Describes assemblies, the building blocks of managed applications. diff --git a/docs/framework/configure-apps/file-schema/runtime/generatepublisherevidence-element.md b/docs/framework/configure-apps/file-schema/runtime/generatepublisherevidence-element.md index 83be5961cde8d..5f95c5dde08aa 100644 --- a/docs/framework/configure-apps/file-schema/runtime/generatepublisherevidence-element.md +++ b/docs/framework/configure-apps/file-schema/runtime/generatepublisherevidence-element.md @@ -49,7 +49,7 @@ Specifies whether the runtime creates ev ## Remarks > [!NOTE] -> In the .NET Framework 4 and later, this element has no effect on assembly load times. For more information, see the "Security Policy Simplification" section in [Security Changes](../../../security/security-changes.md). +> In the .NET Framework 4 and later, this element has no effect on assembly load times. For more information, see the "Security Policy Simplification" section in [Security Changes](https://docs.microsoft.com/previous-versions/dotnet/framework/security/security-changes). The common language runtime (CLR) tries to verify the Authenticode signature at load time to create evidence for the assembly. However, by default, most applications do not need evidence. Standard CAS policy does not rely on the . You should avoid the unnecessary startup cost associated with verifying the publisher signature unless your application executes on a computer with custom CAS policy, or is intending to satisfy demands for in a partial-trust environment. (Demands for identity permissions always succeed in a full-trust environment.) diff --git a/docs/framework/configure-apps/file-schema/windows-identity-foundation/sessionsecuritytokencache.md b/docs/framework/configure-apps/file-schema/windows-identity-foundation/sessionsecuritytokencache.md index 256c8c4ea6ff9..0a26ad009a6aa 100644 --- a/docs/framework/configure-apps/file-schema/windows-identity-foundation/sessionsecuritytokencache.md +++ b/docs/framework/configure-apps/file-schema/windows-identity-foundation/sessionsecuritytokencache.md @@ -45,7 +45,7 @@ Registers a cache for session tokens with a service or a security token handler |[\](caches.md)|Registers the caches used by a service or a security token handler collection.| ## Example - The following XML shows the configuration of a custom cache for holding session security tokens (). The configuration is taken from the `ClaimsAwareWebFarm` sample. For more information about this sample, see [WIF Code Sample Index](../../../security/wif-code-sample-index.md). + The following XML shows the configuration of a custom cache for holding session security tokens (). The configuration is taken from the `ClaimsAwareWebFarm` sample. For more information about this sample, see [WIF Code Sample Index](https://docs.microsoft.com/previous-versions/dotnet/framework/security/wif-code-sample-index). ```xml diff --git a/docs/framework/configure-apps/how-to-create-a-publisher-policy.md b/docs/framework/configure-apps/how-to-create-a-publisher-policy.md index 6bf33b056a3b7..a33d86ae3bc2b 100644 --- a/docs/framework/configure-apps/how-to-create-a-publisher-policy.md +++ b/docs/framework/configure-apps/how-to-create-a-publisher-policy.md @@ -103,7 +103,7 @@ gacutil /i policy.1.0.myAssembly.dll ## See also -- [Programming with Assemblies](../../standard/assembly/program.md) +- [Programming with Assemblies](../../standard/assembly/index.md) - [How the Runtime Locates Assemblies](../deployment/how-the-runtime-locates-assemblies.md) - [Configuring Apps by using Configuration Files](index.md) - [Runtime Settings Schema](./file-schema/runtime/index.md) diff --git a/docs/framework/configure-apps/redirect-assembly-versions.md b/docs/framework/configure-apps/redirect-assembly-versions.md index 7358f20270416..cbe51d03a097e 100644 --- a/docs/framework/configure-apps/redirect-assembly-versions.md +++ b/docs/framework/configure-apps/redirect-assembly-versions.md @@ -152,7 +152,7 @@ You can enable automatic binding redirection if your app targets older versions - [\ Element](./file-schema/runtime/bindingredirect-element.md) - [Assembly Binding Redirection Security Permission](assembly-binding-redirection-security-permission.md) - [Assemblies in .NET](../../standard/assembly/index.md) -- [Programming with Assemblies](../../standard/assembly/program.md) +- [Programming with Assemblies](../../standard/assembly/index.md) - [How the Runtime Locates Assemblies](../deployment/how-the-runtime-locates-assemblies.md) - [Configuring Apps](index.md) - [Runtime Settings Schema](./file-schema/runtime/index.md) diff --git a/docs/framework/configure-apps/specify-assembly-location.md b/docs/framework/configure-apps/specify-assembly-location.md index 67bee865a5178..77c6f0d1b80f3 100644 --- a/docs/framework/configure-apps/specify-assembly-location.md +++ b/docs/framework/configure-apps/specify-assembly-location.md @@ -62,6 +62,6 @@ There are two ways to specify an assembly's location: ## See also - [Assemblies in .NET](../../standard/assembly/index.md) -- [Programming with Assemblies](../../standard/assembly/program.md) +- [Programming with Assemblies](../../standard/assembly/index.md) - [How the Runtime Locates Assemblies](../deployment/how-the-runtime-locates-assemblies.md) - [Configuring Apps by using Configuration Files](index.md) diff --git a/docs/framework/data/adonet/code-access-security.md b/docs/framework/data/adonet/code-access-security.md index d3d237c6018a5..e3edc7fcec888 100644 --- a/docs/framework/data/adonet/code-access-security.md +++ b/docs/framework/data/adonet/code-access-security.md @@ -44,7 +44,7 @@ The .NET Framework offers role-based security as well as code access security (C Depending on the type of application you are building, you should also consider implementing role-based permissions in the database. For more information on role-based security in SQL Server, see [SQL Server Security](./sql/sql-server-security.md). ## Assemblies - Assemblies form the fundamental unit of deployment, version control, reuse, activation scoping, and security permissions for a .NET Framework application. An assembly provides a collection of types and resources that are built to work together and form a logical unit of functionality. To the CLR, a type does not exist outside the context of an assembly. For more information on creating and deploying assemblies, see [Programming with Assemblies](../../../standard/assembly/program.md). + Assemblies form the fundamental unit of deployment, version control, reuse, activation scoping, and security permissions for a .NET Framework application. An assembly provides a collection of types and resources that are built to work together and form a logical unit of functionality. To the CLR, a type does not exist outside the context of an assembly. For more information on creating and deploying assemblies, see [Programming with Assemblies](../../../standard/assembly/index.md). ### Strong-naming Assemblies A strong name, or digital signature, consists of the assembly's identity, which includes its simple text name, version number, and culture information (if provided), plus a public key and a digital signature. The digital signature is generated from an assembly file using the corresponding private key. The assembly file contains the assembly manifest, which contains the names and hashes of all the files that make up the assembly. diff --git a/docs/framework/data/adonet/ef/terminology.md b/docs/framework/data/adonet/ef/terminology.md index 59e93d415085b..3956bc95b55b5 100644 --- a/docs/framework/data/adonet/ef/terminology.md +++ b/docs/framework/data/adonet/ef/terminology.md @@ -16,7 +16,7 @@ This topic defines terms frequently referenced in Entity Framework documentation |ComplexType|The specification for a data type that represents a non-scalar property of an entity type that does not have a key property.

For more information, see [ComplexType Element (CSDL)](/ef/ef6/modeling/designer/advanced/edmx/csdl-spec#complextype-element-csdl) and [complex type](../complex-type.md).| |conceptual model|An abstract specification for the entity types, complex types, associations, entity containers, entity sets, and association sets in the domain of an application in the Entity Framework. The conceptual model is defined in CSDL in the .csdl file.

For more information, see [Modeling and Mapping](modeling-and-mapping.md).| |.csdl file|An XML file that contains the conceptual model, expressed in CSDL.| -|conceptual schema definition language (CSDL)|An XML-based language that is used to define the entity types, associations, entity containers, entity sets, and association sets of a conceptual model.

For more information, see [CSDL Specification](./language-reference/csdl-specification.md).| +|conceptual schema definition language (CSDL)|An XML-based language that is used to define the entity types, associations, entity containers, entity sets, and association sets of a conceptual model.

For more information, see [CSDL Specification](/ef/ef6/modeling/designer/advanced/edmx/csdl-spec).| |container|A logical grouping of entity and association sets.

For more information, see [EntityContainer Element (CSDL)](/ef/ef6/modeling/designer/advanced/edmx/csdl-spec#entitycontainer-element-csdl) and [entity container](../entity-container.md).| |concurrency|A process that allows multiple users to access and change shared data at the same time. By default, the Entity Framework implements an optimistic concurrency model.| |direction|Refers to the asymmetrical nature of some associations. Direction is specified with `FromRole` and `ToRole` attributes of a `NavigationProperty` or `ReferentialConstraint` element in a schema.

For more information, see [NavigationProperty Element (CSDL)](/ef/ef6/modeling/designer/advanced/edmx/csdl-spec#navigationproperty-element-csdl) and [navigation property](../navigation-property.md).| @@ -39,9 +39,9 @@ This topic defines terms frequently referenced in Entity Framework documentation |key|The attribute of an entity type that specifies which property or set of properties is used to identify unique instances of the entity type. Represented in the object layer by the class.

For more information, see [Key Element (CSDL)](/ef/ef6/modeling/designer/advanced/edmx/csdl-spec#key-element-csdl) and [entity key](../entity-key.md).| |lazy loading|When objects are returned by a query, related objects are not loaded at the same time. Instead they are loaded automatically when the navigation property is accessed.| |LINQ to Entities|A query syntax that defines a set of query operators that allow traversal, filter, and projection operations to be expressed in a direct, declarative way in Visual C# and Visual Basic.

For more information, see [LINQ to Entities](./language-reference/linq-to-entities.md).| -|mapping|A specification of the correspondences between items in a conceptual model and items in a storage model.

For more information, see [MSL Specification](./language-reference/msl-specification.md).| +|mapping|A specification of the correspondences between items in a conceptual model and items in a storage model.

For more information, see [MSL Specification](/ef/ef6/modeling/designer/advanced/edmx/msl-spec).| |.msl file|An XML file that contains the mapping between the conceptual model and the storage model, expressed in MSL.| -|mapping specification language (MSL)|An XML-based language that is used to map items defined in a conceptual model to items in a storage model.

For more information, see [MSL Specification](./language-reference/msl-specification.md).| +|mapping specification language (MSL)|An XML-based language that is used to map items defined in a conceptual model to items in a storage model.

For more information, see [MSL Specification](/ef/ef6/modeling/designer/advanced/edmx/msl-spec).| |modification functions|Stored procedures that are used to insert, update, and delete data that is in the data source. These functions are used in place of Entity Framework generated commands. Modification functions are defined by the `Function` element in the storage model. The [ModificationFunctionMapping](https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/cc716778(v=vs.100)) element maps these modification functions to insert, update, and delete operations against entities that are defined in the conceptual model.| |multiplicity|The number of entities that can exist on each side of a relationship, as defined by an association. Also known as cardinality.

For more information, see [End Element (CSDL)](/ef/ef6/modeling/designer/advanced/edmx/csdl-spec#end-element-csdl) and [association end](../association-end.md).| |multiple entity sets per type|The ability for an entity type to be defined in more than one entity set.

For more information, see [EntitySet Element (CSDL)](/ef/ef6/modeling/designer/advanced/edmx/csdl-spec#entityset-element-csdl) and [How to: Define a Model with Multiple Entity Sets per Type](https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/bb738537(v=vs.100)).| diff --git a/docs/framework/development-guide.md b/docs/framework/development-guide.md index 51d23c1a3568b..4990e67bed151 100644 --- a/docs/framework/development-guide.md +++ b/docs/framework/development-guide.md @@ -5,12 +5,11 @@ helpviewer_keywords: - ".NET Framework, development guide" ms.assetid: 26e3d285-24c3-435c-a797-9fe5affb8525 --- -# .NET Framework Development Guide +# .NET Framework development guide + This section explains how to create, configure, debug, secure, and deploy your .NET Framework apps. The section also provides information about technology areas such as dynamic programming, interoperability, extensibility, memory management, and threading. -## In This Section - [Application Essentials](../standard/application-essentials.md) - Provides information about basic app development tasks, such as programming with app domains and assemblies, using attributes, formatting and parsing base types, using collections, handling events and exceptions, using files and data streams, and using generics. +## In This Section [Data and Modeling](./data/index.md) Provides information about how to access data using ADO.NET, Language Integrated Query (LINQ), WCF Data Services, and XML. diff --git a/docs/framework/migration-guide/mitigation-ziparchiveentry-fullname-path-separator.md b/docs/framework/migration-guide/mitigation-ziparchiveentry-fullname-path-separator.md index b010d9d255e14..80a4b1d30409d 100644 --- a/docs/framework/migration-guide/mitigation-ziparchiveentry-fullname-path-separator.md +++ b/docs/framework/migration-guide/mitigation-ziparchiveentry-fullname-path-separator.md @@ -38,5 +38,4 @@ Starting with apps that target the .NET Framework 4.6.1, the path separator used ## See also -- [Retargeting Changes](retargeting-changes-in-the-net-framework-4-6-1.md) - [Application compatibility](application-compatibility.md) diff --git a/docs/framework/misc/code-access-security-basics.md b/docs/framework/misc/code-access-security-basics.md index f971a56ec4d01..65f6a82a55908 100644 --- a/docs/framework/misc/code-access-security-basics.md +++ b/docs/framework/misc/code-access-security-basics.md @@ -48,7 +48,7 @@ Code access security does not eliminate the possibility of human error in writin Declarative security syntax uses [attributes](../../standard/attributes/index.md) to place security information into the [metadata](../../standard/metadata-and-self-describing-components.md) of your code. Attributes can be placed at the assembly, class, or member level, to indicate the type of request, demand, or override you want to use. Requests are used in applications that target the common language runtime to inform the runtime security system about the permissions that your application needs or does not want. Demands and overrides are used in libraries to help protect resources from callers or to override default security behavior. > [!NOTE] -> In the .NET Framework 4, there have been important changes to the .NET Framework security model and terminology. For more information about these changes, see [Security Changes](../security/security-changes.md). +> In the .NET Framework 4, there have been important changes to the .NET Framework security model and terminology. For more information about these changes, see [Security Changes](https://docs.microsoft.com/previous-versions/dotnet/framework/security/security-changes). In order to use declarative security calls, you must initialize the state data of the permission object so that it represents the particular form of permission you need. Every built-in permission has an attribute that is passed a enumeration to describe the type of security operation you want to perform. However, permissions also accept their own parameters that are exclusive to them. diff --git a/docs/framework/misc/code-access-security.md b/docs/framework/misc/code-access-security.md index 55fdf0ce6e80c..ae4b9c99bc6d8 100644 --- a/docs/framework/misc/code-access-security.md +++ b/docs/framework/misc/code-access-security.md @@ -26,7 +26,7 @@ ms.assetid: 859af632-c80d-4736-8d6f-1e01b09ce127 The .NET Framework provides a security mechanism called code access security to help protect computer systems from malicious mobile code, to allow code from unknown origins to run with protection, and to help prevent trusted code from intentionally or accidentally compromising security. Code access security enables code to be trusted to varying degrees depending on where the code originates and on other aspects of the code's identity. Code access security also enforces the varying levels of trust on code, which minimizes the amount of code that must be fully trusted in order to run. Using code access security can reduce the likelihood that your code will be misused by malicious or error-filled code. It can reduce your liability, because you can specify the set of operations your code should be allowed to perform. Code access security can also help minimize the damage that can result from security vulnerabilities in your code. > [!NOTE] -> Major changes have been made to code access security in the .NET Framework 4. The most notable change has been [security transparency](security-transparent-code.md), but there are also other significant changes that affect code access security. For information about these changes, see [Security Changes](../security/security-changes.md). +> Major changes have been made to code access security in the .NET Framework 4. The most notable change has been [security transparency](security-transparent-code.md), but there are also other significant changes that affect code access security. For information about these changes, see [Security Changes](https://docs.microsoft.com/previous-versions/dotnet/framework/security/security-changes). Code access security primarily affects library code and partially trusted applications. Library developers must protect their code from unauthorized access from partially trusted applications. Partially trusted applications are applications that are loaded from external sources such as the Internet. Applications that are installed on your desktop or on the local intranet run in full trust. Full-trust applications are not affected by code access security unless they are marked as [security-transparent](security-transparent-code.md), because they are fully trusted. The only limitation for full-trust applications is that applications that are marked with the attribute cannot call code that is marked with the attribute. Partially trusted applications must be run in a sandbox (for example, in Internet Explorer) so that code access security can be applied. If you download an application from the Internet and try to run it from your desktop, you will get a with the message: "An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous." If you are sure that the application can be trusted, you can enable it to be run as full trust by using the [\ element](../configure-apps/file-schema/runtime/loadfromremotesources-element.md). For information about running an application in a sandbox, see [How to: Run Partially Trusted Code in a Sandbox](how-to-run-partially-trusted-code-in-a-sandbox.md). diff --git a/docs/framework/misc/dangerous-permissions-and-policy-administration.md b/docs/framework/misc/dangerous-permissions-and-policy-administration.md index ac48f7668d333..2d7734eeded94 100644 --- a/docs/framework/misc/dangerous-permissions-and-policy-administration.md +++ b/docs/framework/misc/dangerous-permissions-and-policy-administration.md @@ -13,7 +13,7 @@ ms.assetid: 1929e854-23a0-4bb1-94be-e8aa3b609e32 Several of the protected operations for which the .NET Framework provides permissions can potentially allow the security system to be circumvented. These dangerous permissions should be given only to trustworthy code, and then only as necessary. There is usually no defense against malicious code if it is granted these permissions. > [!NOTE] -> In the .NET Framework 4, there have been important changes to the .NET Framework security model and terminology. For more information about these changes, see [Security Changes](../security/security-changes.md). +> In the .NET Framework 4, there have been important changes to the .NET Framework security model and terminology. For more information about these changes, see [Security Changes](https://docs.microsoft.com/previous-versions/dotnet/framework/security/security-changes). The dangerous permissions are explained in the following table. diff --git a/docs/framework/misc/security-transparent-code-level-1.md b/docs/framework/misc/security-transparent-code-level-1.md index 5ebb7f3eaeb07..90c377d286cac 100644 --- a/docs/framework/misc/security-transparent-code-level-1.md +++ b/docs/framework/misc/security-transparent-code-level-1.md @@ -125,4 +125,4 @@ public class B ## See also - [Security-Transparent Code, Level 2](security-transparent-code-level-2.md) -- [Security Changes](../security/security-changes.md) +- [Security Changes](https://docs.microsoft.com/previous-versions/dotnet/framework/security/security-changes) diff --git a/docs/framework/misc/security-transparent-code-level-2.md b/docs/framework/misc/security-transparent-code-level-2.md index cca942c1017c2..8cb70fc696219 100644 --- a/docs/framework/misc/security-transparent-code-level-2.md +++ b/docs/framework/misc/security-transparent-code-level-2.md @@ -174,4 +174,4 @@ The ## See also - [Security-Transparent Code, Level 1](security-transparent-code-level-1.md) -- [Security Changes](../security/security-changes.md) +- [Security Changes](https://docs.microsoft.com/previous-versions/dotnet/framework/security/security-changes) diff --git a/docs/framework/misc/using-libraries-from-partially-trusted-code.md b/docs/framework/misc/using-libraries-from-partially-trusted-code.md index 33fc0e462d859..0fe6eec3f3797 100644 --- a/docs/framework/misc/using-libraries-from-partially-trusted-code.md +++ b/docs/framework/misc/using-libraries-from-partially-trusted-code.md @@ -14,7 +14,7 @@ ms.assetid: dd66cd4c-b087-415f-9c3e-94e3a1835f74 [!INCLUDE[net_security_note](../../../includes/net-security-note-md.md)] > [!NOTE] -> This topic addresses the behavior of strong-named assemblies and applies only to [Level 1](security-transparent-code-level-1.md) assemblies. [Security-Transparent Code, Level 2](security-transparent-code-level-2.md) assemblies in the .NET Framework 4 or later are not affected by strong names. For more information about changes to the security system, see [Security Changes](../security/security-changes.md). +> This topic addresses the behavior of strong-named assemblies and applies only to [Level 1](security-transparent-code-level-1.md) assemblies. [Security-Transparent Code, Level 2](security-transparent-code-level-2.md) assemblies in the .NET Framework 4 or later are not affected by strong names. For more information about changes to the security system, see [Security Changes](https://docs.microsoft.com/previous-versions/dotnet/framework/security/security-changes). Applications that receive less than full trust from their host or sandbox are not allowed to call shared managed libraries unless the library writer specifically allows them to through the use of the attribute. Therefore, application writers must be aware that some libraries will not be available to them from a partially trusted context. By default, all code that executes in a partial-trust [sandbox](how-to-run-partially-trusted-code-in-a-sandbox.md) and is not in the list of full-trust assemblies is partially trusted. If you do not expect your code to be executed from a partially trusted context or to be called by partially trusted code, you do not have to be concerned about the information in this section. However, if you write code that must interact with partially trusted code or operate from a partially trusted context, you should consider the following factors: diff --git a/docs/framework/performance/etw-events-in-task-parallel-library-and-plinq.md b/docs/framework/performance/etw-events-in-task-parallel-library-and-plinq.md index 9b7e5aefee6b0..40117e059c2d9 100644 --- a/docs/framework/performance/etw-events-in-task-parallel-library-and-plinq.md +++ b/docs/framework/performance/etw-events-in-task-parallel-library-and-plinq.md @@ -110,4 +110,4 @@ EVENT_DESCRIPTOR.Id = 1 - [ETW Events in the .NET Framework](etw-events.md) - [Task Parallel Library (TPL)](../../standard/parallel-programming/task-parallel-library-tpl.md) -- [Parallel LINQ (PLINQ)](../../standard/parallel-programming/parallel-linq-plinq.md) +- [Parallel LINQ (PLINQ)](../../standard/parallel-programming/introduction-to-plinq.md) diff --git a/docs/framework/performance/etw-events.md b/docs/framework/performance/etw-events.md index 5e1b81672f984..c9cf33f4bb919 100644 --- a/docs/framework/performance/etw-events.md +++ b/docs/framework/performance/etw-events.md @@ -9,7 +9,7 @@ ms.assetid: d186276f-6afb-4dfd-bf3c-4251edc2c299 # ETW Events in the .NET Framework Event tracing for Windows (ETW) is a high-performance, low-overhead, scalable tracing system provided by Windows operating systems. It supplements the profiling and debugging support provided by the .NET Framework and can be used to troubleshoot a variety of scenarios. - In the .NET Framework, ETW event tracing is available for the common language runtime (CLR), the [Task Parallel Library](../../standard/parallel-programming/task-parallel-library-tpl.md), and [Parallel LINQ (PLINQ)](../../standard/parallel-programming/parallel-linq-plinq.md). + In the .NET Framework, ETW event tracing is available for the common language runtime (CLR), the [Task Parallel Library](../../standard/parallel-programming/task-parallel-library-tpl.md), and [Parallel LINQ (PLINQ)](../../standard/parallel-programming/introduction-to-plinq.md). ## In This Section [ETW Events in Task Parallel Library and PLINQ](etw-events-in-task-parallel-library-and-plinq.md) @@ -22,4 +22,4 @@ Event tracing for Windows (ETW) is a high-performance, low-overhead, scalable tr - [CLR ETW Events](clr-etw-events.md) - [Task Parallel Library (TPL)](../../standard/parallel-programming/task-parallel-library-tpl.md) -- [Parallel LINQ (PLINQ)](../../standard/parallel-programming/parallel-linq-plinq.md) +- [Parallel LINQ (PLINQ)](../../standard/parallel-programming/introduction-to-plinq.md) diff --git a/docs/framework/reflection-and-codedom/security-considerations-for-reflection.md b/docs/framework/reflection-and-codedom/security-considerations-for-reflection.md index d21b03c1adac4..d911f267e9d83 100644 --- a/docs/framework/reflection-and-codedom/security-considerations-for-reflection.md +++ b/docs/framework/reflection-and-codedom/security-considerations-for-reflection.md @@ -53,7 +53,7 @@ These rules are the same whether a security-critical member is accessed directly Application code that is run from the command line runs with full trust. As long as it is not marked as transparent, it can use reflection to access security-critical members. When the same code is run with partial trust (for example, in a sandboxed application domain) the assembly's trust level determines whether it can access security-critical code: If the assembly has a strong name and is installed in the global assembly cache, it is a trusted assembly and can call security-critical members. If it is not trusted, it becomes transparent even though it was not marked as transparent, and it cannot access security-critical members. -For more information about the security model in the .NET Framework 4, see [Security Changes](../security/security-changes.md). +For more information about the security model in the .NET Framework 4, see [Security Changes](https://docs.microsoft.com/previous-versions/dotnet/framework/security/security-changes). ## Reflection and Transparency @@ -109,7 +109,7 @@ Avoid writing public members that take param - - - -- [Security Changes](../security/security-changes.md) +- [Security Changes](https://docs.microsoft.com/previous-versions/dotnet/framework/security/security-changes) - [Code Access Security](../misc/code-access-security.md) - [Security Issues in Reflection Emit](security-issues-in-reflection-emit.md) - [Viewing Type Information](viewing-type-information.md) diff --git a/docs/framework/reflection-and-codedom/security-issues-in-reflection-emit.md b/docs/framework/reflection-and-codedom/security-issues-in-reflection-emit.md index ad4ac3e77c991..2843b637f5aee 100644 --- a/docs/framework/reflection-and-codedom/security-issues-in-reflection-emit.md +++ b/docs/framework/reflection-and-codedom/security-issues-in-reflection-emit.md @@ -28,7 +28,7 @@ The .NET Framework provides three ways to emit Microsoft intermediate language ( ## Dynamic Assemblies - Dynamic assemblies are created by using overloads of the method. Most overloads of this method are deprecated in the .NET Framework 4, because of the elimination of machine-wide security policy. (See [Security Changes](../security/security-changes.md).) The remaining overloads can be executed by any code, regardless of trust level. These overloads fall into two groups: those that specify a list of attributes to apply to the dynamic assembly when it is created, and those that do not. If you do not specify the transparency model for the assembly, by applying the attribute when you create it, the transparency model is inherited from the emitting assembly. + Dynamic assemblies are created by using overloads of the method. Most overloads of this method are deprecated in the .NET Framework 4, because of the elimination of machine-wide security policy. (See [Security Changes](https://docs.microsoft.com/previous-versions/dotnet/framework/security/security-changes).) The remaining overloads can be executed by any code, regardless of trust level. These overloads fall into two groups: those that specify a list of attributes to apply to the dynamic assembly when it is created, and those that do not. If you do not specify the transparency model for the assembly, by applying the attribute when you create it, the transparency model is inherited from the emitting assembly. > [!NOTE] > Attributes that you apply to the dynamic assembly after it is created, by using the method, do not take effect until the assembly has been saved to disk and loaded into memory again. @@ -131,7 +131,7 @@ The .NET Framework provides three ways to emit Microsoft intermediate language ( ## Version Information - Starting with the .NET Framework 4, machine-wide security policy is eliminated and security transparency becomes the default enforcement mechanism. See [Security Changes](../security/security-changes.md). + Starting with the .NET Framework 4, machine-wide security policy is eliminated and security transparency becomes the default enforcement mechanism. See [Security Changes](https://docs.microsoft.com/previous-versions/dotnet/framework/security/security-changes). Starting with the .NET Framework 2.0 Service Pack 1, with the flag is no longer required when emitting dynamic assemblies and dynamic methods. This flag is required in all earlier versions of the .NET Framework. diff --git a/docs/framework/resources/index.md b/docs/framework/resources/index.md index 552f78129227b..5e0d36ff1df2b 100644 --- a/docs/framework/resources/index.md +++ b/docs/framework/resources/index.md @@ -60,7 +60,6 @@ You can then retrieve resources for the current UI culture or for a specific cul - - -- [Application Essentials](../../standard/application-essentials.md) - [Creating Resource Files](creating-resource-files-for-desktop-apps.md) - [Packaging and Deploying Resources](packaging-and-deploying-resources-in-desktop-apps.md) - [Creating Satellite Assemblies](creating-satellite-assemblies-for-desktop-apps.md) diff --git a/docs/framework/tools/al-exe-assembly-linker.md b/docs/framework/tools/al-exe-assembly-linker.md index 22894ff1e75b4..9065484dae957 100644 --- a/docs/framework/tools/al-exe-assembly-linker.md +++ b/docs/framework/tools/al-exe-assembly-linker.md @@ -170,5 +170,5 @@ al t2.netmodule /target:exe /out:t2a.exe /main:MyClass.Main - [Tools](index.md) - [*Sn.exe* (Strong Name Tool)](sn-exe-strong-name-tool.md) - [*Gacutil.exe* (Global Assembly Cache Tool)](gacutil-exe-gac-tool.md) -- [Programming with Assemblies](../../standard/assembly/program.md) +- [Programming with Assemblies](../../standard/assembly/index.md) - [Command Prompts](developer-command-prompt-for-vs.md) diff --git a/docs/framework/tools/caspol-exe-code-access-security-policy-tool.md b/docs/framework/tools/caspol-exe-code-access-security-policy-tool.md index 8cc7c0118a91f..858e12a32b4da 100644 --- a/docs/framework/tools/caspol-exe-code-access-security-policy-tool.md +++ b/docs/framework/tools/caspol-exe-code-access-security-policy-tool.md @@ -20,7 +20,7 @@ ms.assetid: d2bf6123-7b0c-4e60-87ad-a39a1c3eb2e0 The Code Access Security (CAS) Policy tool (Caspol.exe) enables users and administrators to modify security policy for the machine policy level, the user policy level, and the enterprise policy level. > [!IMPORTANT] -> Starting with the .NET Framework 4, Caspol.exe does not affect CAS policy unless the [\ element](../configure-apps/file-schema/runtime/netfx40-legacysecuritypolicy-element.md) is set to `true`. Any settings shown or modified by CasPol.exe will only affect applications that opt into using CAS policy. For more information, see [Security Changes](../security/security-changes.md). +> Starting with the .NET Framework 4, Caspol.exe does not affect CAS policy unless the [\ element](../configure-apps/file-schema/runtime/netfx40-legacysecuritypolicy-element.md) is set to `true`. Any settings shown or modified by CasPol.exe will only affect applications that opt into using CAS policy. For more information, see [Security Changes](https://docs.microsoft.com/previous-versions/dotnet/framework/security/security-changes). > [!NOTE] > 64-bit computers include both 64-bit and 32-bit versions of security policy. To ensure that your policy changes apply to both 32-bit and 64-bit applications, run both the 32-bit and 64-bit versions of Caspol.exe. @@ -48,7 +48,7 @@ caspol [options] |**-customall** *path*

or

**-ca** *path*|Indicates that all options following this one apply to the machine, enterprise, and the specified custom user policies. You must specify the location of the custom user's security configuration file with the *path* argument.| |**-cu**[**stomuser**] *path*|Allows the administration of a custom user policy that does not belong to the user on whose behalf Caspol.exe is currently running. You must specify the location of the custom user's security configuration file with the *path* argument.| |**-enterprise**

or

**-en**|Indicates that all options following this one apply to the enterprise level policy. Users who are not enterprise administrators do not have sufficient rights to modify the enterprise policy, although they can view it. In nonenterprise scenarios, this policy, by default, does not interfere with machine and user policy.| -|**-e**[**xecution**] {**on** | **off**}|Turns on or off the mechanism that checks for the permission to run before code starts to execute. **Note:** This switch is removed in the .NET Framework 4 and later versions. For more information, see [Security Changes](../security/security-changes.md).| +|**-e**[**xecution**] {**on** | **off**}|Turns on or off the mechanism that checks for the permission to run before code starts to execute. **Note:** This switch is removed in the .NET Framework 4 and later versions. For more information, see [Security Changes](https://docs.microsoft.com/previous-versions/dotnet/framework/security/security-changes).| |**-f**[**orce**]|Suppresses the tool's self-destruct test and changes the policy as specified by the user. Normally, Caspol.exe checks whether any policy changes would prevent Caspol.exe itself from running properly; if so, Caspol.exe does not save the policy change and prints an error message. To force Caspol.exe to change policy even if this prevents Caspol.exe itself from running, use the **–force** option.| |**-h**[**elp**]|Displays command syntax and options for Caspol.exe.| |**-l**[**ist**]|Lists the code group hierarchy and the permission sets for the specified machine, user, enterprise, or all policy levels. Caspol.exe displays the code group's label first, followed by the name, if it is not null.| @@ -67,7 +67,7 @@ caspol [options] |**-resetlockdown**

or

**-rsld**|Returns policy to a more restrictive version of the default state and persists it to disk; creates a backup of the previous machine policy and persists it to a file called `security.config.bac`. The locked down policy is similar to the default policy, except that the policy grants no permission to code from the `Local Intranet`, `Trusted Sites`, and `Internet` zones and the corresponding code groups have no child code groups.| |**-resolvegroup** *assembly_file*

or

**-rsg** *assembly_file*|Shows the code groups that a specific assembly (*assembly_file*) belongs to. By default, this option displays the machine, user, and enterprise policy levels to which the assembly belongs. To view only one policy level, use this option with either the **-machine**, **-user**, or **-enterprise** option.| |**-resolveperm** *assembly_file*

or

**-rsp** *assembly_file*|Displays all permissions that the specified (or default) level of security policy would grant the assembly if the assembly were allowed to run. The *assembly_file* argument specifies the assembly. If you specify the **-all** option, Caspol.exe calculates the permissions for the assembly based on user, machine, and enterprise policy; otherwise, default behavior rules apply.| -|**-s**[**ecurity**] {**on** | **off**}|Turns code access security on or off. Specifying the **-s off** option does not disable role-based security. **Note:** This switch is removed in the .NET Framework 4 and later versions. For more information, see [Security Changes](../security/security-changes.md). **Caution:** When code access security is disabled, all code access demands succeed. Disabling code access security makes the system vulnerable to attacks by malicious code such as viruses and worms. Turning off security gains some extra performance but should only be done when other security measures have been taken to help make sure overall system security is not breached. Examples of other security precautions include disconnecting from public networks, physically securing computers, and so on.| +|**-s**[**ecurity**] {**on** | **off**}|Turns code access security on or off. Specifying the **-s off** option does not disable role-based security. **Note:** This switch is removed in the .NET Framework 4 and later versions. For more information, see [Security Changes](https://docs.microsoft.com/previous-versions/dotnet/framework/security/security-changes). **Caution:** When code access security is disabled, all code access demands succeed. Disabling code access security makes the system vulnerable to attacks by malicious code such as viruses and worms. Turning off security gains some extra performance but should only be done when other security measures have been taken to help make sure overall system security is not breached. Examples of other security precautions include disconnecting from public networks, physically securing computers, and so on.| |**-u**[**ser**]|Indicates that all options following this one apply to the user level policy for the user on whose behalf Caspol.exe is running. For nonadministrative users, **-user** is the default.| |**-?**|Displays command syntax and options for Caspol.exe.| diff --git a/docs/framework/tools/index.md b/docs/framework/tools/index.md index 1eb96444c0c5f..d3fa1bf0cad20 100644 --- a/docs/framework/tools/index.md +++ b/docs/framework/tools/index.md @@ -30,7 +30,7 @@ Generates a file that has an assembly manifest from modules or resource files. Converts type definitions in a COM type library for an ActiveX control into a Windows Forms control. - [Caspol.exe (Code Access Security Policy Tool)](caspol-exe-code-access-security-policy-tool.md) -Enables you to view and configure security policy for the machine policy level, the user policy level, and the enterprise policy level. In the .NET Framework 4 and later, this tool does not affect code access security (CAS) policy unless the [\ element](../configure-apps/file-schema/runtime/netfx40-legacysecuritypolicy-element.md) is set to `true`. For more information, see [Security Changes](../security/security-changes.md). +Enables you to view and configure security policy for the machine policy level, the user policy level, and the enterprise policy level. In the .NET Framework 4 and later, this tool does not affect code access security (CAS) policy unless the [\ element](../configure-apps/file-schema/runtime/netfx40-legacysecuritypolicy-element.md) is set to `true`. For more information, see [Security Changes](https://docs.microsoft.com/previous-versions/dotnet/framework/security/security-changes). - [Cert2spc.exe (Software Publisher Certificate Test Tool)](cert2spc-exe-software-publisher-certificate-test-tool.md) Creates a Software Publisher's Certificate (SPC) from one or more X.509 certificates. This tool is for testing purposes only. diff --git a/docs/framework/whats-new/index.md b/docs/framework/whats-new/index.md index 4d7725d5ff0f7..4697616912bb5 100644 --- a/docs/framework/whats-new/index.md +++ b/docs/framework/whats-new/index.md @@ -689,7 +689,7 @@ You can see an [example of .NET Framework 4.7 cryptography improvements](https:/ **Better support for control characters by the DataContractJsonSerializer** -In .NET Framework 4.7, the serializes control characters in conformity with the ECMAScript 6 standard. This behavior is enabled by default for applications that target .NET Framework 4.7, and is an opt-in feature for applications that are running under .NET Framework 4.7 but target a previous version of the .NET Framework. For more information, see [Retargeting Changes in the .NET Framework 4.7](../migration-guide/retargeting-changes-in-the-net-framework-4-7.md). +In .NET Framework 4.7, the class serializes control characters in conformity with the ECMAScript 6 standard. This behavior is enabled by default for applications that target .NET Framework 4.7, and is an opt-in feature for applications that are running under .NET Framework 4.7 but target a previous version of .NET Framework. For more information, see the [Application compatibility](../migration-guide/application-compatibility.md) section. @@ -762,11 +762,11 @@ In .NET Framework 4.7, WPF includes the following enhancements: **Support for a touch/stylus stack based on Windows WM_POINTER messages** -You now have the option of using a touch/stylus stack based on [WM_POINTER messages](https://docs.microsoft.com/previous-versions/windows/desktop/InputMsg/messages) instead of the Windows Ink Services Platform (WISP). This is an opt-in feature in the .NET Framework. For more information, see [Retargeting Changes in the .NET Framework 4.7](../migration-guide/retargeting-changes-in-the-net-framework-4-7.md). +You now have the option of using a touch/stylus stack based on [WM_POINTER messages](https://docs.microsoft.com/previous-versions/windows/desktop/InputMsg/messages) instead of the Windows Ink Services Platform (WISP). This is an opt-in feature in .NET Framework. For more information, see the [Application compatibility](../migration-guide/application-compatibility.md) section. **New implementation for WPF printing APIs** -WPF's printing APIs in the class call the Windows [Print Document Package API](/windows/desktop/printdocs/tailored-app-printing-api) instead of the deprecated [XPS Print API](/windows/desktop/printdocs/xps-printing). For the impact of this change on application compatibility, see [Retargeting Changes in the .NET Framework 4.7](../migration-guide/retargeting-changes-in-the-net-framework-4-7.md). +WPF's printing APIs in the class call the Windows [Print Document Package API](/windows/desktop/printdocs/tailored-app-printing-api) instead of the deprecated [XPS Print API](/windows/desktop/printdocs/xps-printing). For the impact of this change on application compatibility, see the [Application compatibility](../migration-guide/application-compatibility.md) section. diff --git a/docs/framework/windows-workflow-foundation/workflow-security.md b/docs/framework/windows-workflow-foundation/workflow-security.md index 4206dba034dd5..2d8ec33ede5a0 100644 --- a/docs/framework/windows-workflow-foundation/workflow-security.md +++ b/docs/framework/windows-workflow-foundation/workflow-security.md @@ -39,7 +39,7 @@ Windows Workflow Foundation (WF) is integrated with several different technologi - The ServiceSecurityContext for the incoming message is also available from within workflow by accessing OperationContext. ## WF Security Pack CTP - The Microsoft WF Security Pack CTP 1 is the first community technology preview (CTP) release of a set of activities and their implementation based on [Windows Workflow Foundation](index.md) in [.NET Framework 4](https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/w0x726c2(v=vs.100)) (WF 4) and the [Windows Identity Foundation (WIF)](../security/index.md). The Microsoft WF Security Pack CTP 1 contains both activities and their designers which illustrate how to easily enable various security-related scenarios using workflow, including: + The Microsoft WF Security Pack community technology preview (CTP) 1 is a set of activities and their implementation based on [Windows Workflow Foundation](index.md) in [.NET Framework 4](https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/w0x726c2(v=vs.100)) (WF 4) and [Windows Identity Foundation (WIF)](https://docs.microsoft.com/previous-versions/dotnet/framework/security/index). The Microsoft WF Security Pack CTP 1 contains both activities and their designers which illustrate how to easily enable various security-related scenarios using workflow, including: 1. Impersonating a client identity in the workflow diff --git a/docs/standard/io/types-of-isolation.md b/docs/standard/io/types-of-isolation.md index 590ad3f9401aa..a853979497baf 100644 --- a/docs/standard/io/types-of-isolation.md +++ b/docs/standard/io/types-of-isolation.md @@ -26,7 +26,7 @@ Access to isolated storage is always restricted to the user who created it. To i - Domain identity represents the evidence of the application, which in the case of a web application might be the full URL. For shell-hosted code, the domain identity might be based on the application directory path. For example, if the executable runs from the path C:\Office\MyApp.exe, the domain identity would be C:\Office\MyApp.exe. -- Assembly identity is the evidence of the assembly. This might come from a cryptographic digital signature, which can be the assembly's [strong name](../assembly/strong-named.md), the software publisher of the assembly, or its URL identity. If an assembly has both a strong name and a software publisher identity, then the software publisher identity is used. If the assembly comes from the Internet and is unsigned, the URL identity is used. For more information about assemblies and strong names, see [Programming with Assemblies](/dotnet/standard/assembly/index). +- Assembly identity is the evidence of the assembly. This might come from a cryptographic digital signature, which can be the assembly's [strong name](../assembly/strong-named.md), the software publisher of the assembly, or its URL identity. If an assembly has both a strong name and a software publisher identity, then the software publisher identity is used. If the assembly comes from the Internet and is unsigned, the URL identity is used. For more information about assemblies and strong names, see [Programming with Assemblies](../assembly/index.md). - Roaming stores move with a user that has a roaming user profile. Files are written to a network directory and are downloaded to any computer the user logs into. For more information about roaming user profiles, see . diff --git a/docs/standard/serialization/system-text-json-migrate-from-newtonsoft-how-to.md b/docs/standard/serialization/system-text-json-migrate-from-newtonsoft-how-to.md index e1d31f0957b9c..bf80e1968cff5 100644 --- a/docs/standard/serialization/system-text-json-migrate-from-newtonsoft-how-to.md +++ b/docs/standard/serialization/system-text-json-migrate-from-newtonsoft-how-to.md @@ -74,7 +74,7 @@ The following table lists `Newtonsoft.Json` features and `System.Text.Json` equi | Allow single quotes around string values | ❌ [Not supported](#json-strings-property-names-and-string-values) | | Allow non-string JSON values for string properties | ❌ [Not supported](#non-string-values-for-string-properties) | -This is not an exhaustive list of `Newtonsoft.Json` features. The list includes many of the scenarios that have been requested in [GitHub issues](https://github.com/dotnet/runtime/issues?q=is%3Aopen+is%3Aissue+label%3Aarea-System.Text.Json) or [StackOverflow](https://stackoverflow.com/questions/tagged/system.text.json) posts. If you implement a workaround for one of the scenarios listed here that doesn't currently have sample code, and if you want to share your solution, select **This page** in the [Feedback section](/dotnet/standard/serialization/system-text-json-migrate-from-newtonsoft-how-to#feedback) of this page. That creates a GitHub issue and lists it at the bottom of this page. +This is not an exhaustive list of `Newtonsoft.Json` features. The list includes many of the scenarios that have been requested in [GitHub issues](https://github.com/dotnet/runtime/issues?q=is%3Aopen+is%3Aissue+label%3Aarea-System.Text.Json) or [StackOverflow](https://stackoverflow.com/questions/tagged/system.text.json) posts. If you implement a workaround for one of the scenarios listed here that doesn't currently have sample code, and if you want to share your solution, select **This page** in the [Feedback section](system-text-json-migrate-from-newtonsoft-how-to.md#feedback) of this page. That creates a GitHub issue and lists it at the bottom of this page. ## Differences in default JsonSerializer behavior compared to Newtonsoft.Json diff --git a/docs/welcome.md b/docs/welcome.md index 75b983afde771..86e5e8e625eaf 100644 --- a/docs/welcome.md +++ b/docs/welcome.md @@ -27,9 +27,9 @@ Also follow the latest .NET events: For information about the latest features added to the .NET implementations and supported languages, see the following articles: -- [What's new in .NET Core](core/whats-new/index.md) +- [What's new in .NET Core 3.1](core/whats-new/dotnet-core-3-1.md) - [What's new in the .NET Framework](framework/whats-new/index.md) -- [What's new in C#](csharp/whats-new/index.md) +- [What's new in C#](csharp/whats-new/csharp-8.md) - [What's new for Visual Basic](visual-basic/getting-started/whats-new.md) ## Documentation diff --git a/docs/whats-new/2019-10.md b/docs/whats-new/2019-10.md index 5107ddbea2744..57e84dd4e081e 100644 --- a/docs/whats-new/2019-10.md +++ b/docs/whats-new/2019-10.md @@ -63,7 +63,7 @@ Welcome to what's new in .NET docs for October 2019. This article lists some of - [How to use DataContractJsonSerializer](../framework/wcf/feature-details/how-to-serialize-and-deserialize-json-data.md) - fix: MD012/no-multiple-blanks - [WPF XAML Browser Applications Overview](../framework/wpf/app-development/wpf-xaml-browser-applications-overview.md) - WPF terminology updates - [Binding Sources Overview](../framework/wpf/data/binding-sources-overview.md) - Move XML dynamic properties files from VS repo -- [Markup Extensions for XAML Overview](../framework/xaml-services/markup-extensions-for-xaml-overview.md) - Replace "default constructor" with "parameterless constructor" +- [Markup Extensions for XAML Overview](../desktop-wpf/xaml-services/markup-extensions-overview.md) - Replace "default constructor" with "parameterless constructor" ## C# language diff --git a/docs/whats-new/dotnet-2020-03.md b/docs/whats-new/dotnet-2020-03.md index 1748b037bd5ac..2648a9cc0669b 100644 --- a/docs/whats-new/dotnet-2020-03.md +++ b/docs/whats-new/dotnet-2020-03.md @@ -48,7 +48,7 @@ Welcome to what's new in .NET docs for March 2020. This article lists some of th ### New articles - [Install .NET for Apache Spark on Jupyter notebooks on Azure HDInsight Spark clusters](../spark/how-to-guides/hdinsight-notebook-installation.md) - Instructions on how to install .NET for Apache Spark interactive notebooks on Azure HDInsight -- [Tutorial: Sentiment analysis with .NET for Apache Spark and ML.NET](../spark/tutorials/ml-sentment-analysis.md) - .NET for Apache Spark: ML Sentiment Analysis +- [Tutorial: Sentiment analysis with .NET for Apache Spark and ML.NET](../spark/tutorials/ml-sentiment-analysis.md) - .NET for Apache Spark: ML Sentiment Analysis ## .NET From 556c49b4057770974f53ca053c5c6a5495a1bcb1 Mon Sep 17 00:00:00 2001 From: Genevieve Warren Date: Fri, 17 Apr 2020 11:15:47 -0700 Subject: [PATCH 6/9] Replace redirects - C# and VB (#17899) * replace redirects * fix bad bookmarks * fix bad bookmark * Update docs/csharp/whats-new/version-update-considerations.md Co-Authored-By: Bill Wagner * revert xref attribute links Co-authored-by: Bill Wagner --- .../csharp/language-reference/compiler-messages/cs0618.md | 2 +- .../compiler-options/target-compiler-option.md | 2 +- docs/csharp/misc/cs0243.md | 8 ++++---- docs/csharp/misc/cs0612.md | 5 +++-- docs/csharp/misc/cs0629.md | 7 ++++--- .../csharp/programming-guide/concepts/attributes/index.md | 4 ++-- docs/csharp/programming-guide/concepts/collections.md | 2 +- docs/csharp/toc.yml | 2 +- docs/csharp/versioning.md | 2 +- .../programming/drives-directories-files/toc.yml | 2 +- .../language-reference/statements/declare-statement.md | 2 +- ...registry-path-does-not-start-with-a-valid-hive-name.md | 2 +- .../programming-guide/concepts/collections.md | 2 +- docs/visual-basic/programming-guide/concepts/linq/toc.yml | 2 +- .../how-to-create-strings-using-a-stringbuilder.md | 2 +- docs/visual-basic/toc.yml | 4 ++-- 16 files changed, 26 insertions(+), 24 deletions(-) diff --git a/docs/csharp/language-reference/compiler-messages/cs0618.md b/docs/csharp/language-reference/compiler-messages/cs0618.md index f0ccd456a8ca6..6b292c6adabea 100644 --- a/docs/csharp/language-reference/compiler-messages/cs0618.md +++ b/docs/csharp/language-reference/compiler-messages/cs0618.md @@ -10,7 +10,7 @@ ms.assetid: b6edf0a9-b186-4ed8-9e16-978659b89205 # Compiler Warning (level 2) CS0618 'member' is obsolete: 'text' - A class member was marked with the `Obsolete` attribute, such that a warning will be issued when the class member is referenced. For more information, see [Common Attributes](../../programming-guide/concepts/attributes/common-attributes.md). + A class member was marked with the `Obsolete` attribute, such that a warning will be issued when the class member is referenced. For more information, see [Common Attributes](../attributes/global.md). The following sample generates CS0618: diff --git a/docs/csharp/language-reference/compiler-options/target-compiler-option.md b/docs/csharp/language-reference/compiler-options/target-compiler-option.md index 3ea04bfecdebc..68c8b22353559 100644 --- a/docs/csharp/language-reference/compiler-options/target-compiler-option.md +++ b/docs/csharp/language-reference/compiler-options/target-compiler-option.md @@ -31,7 +31,7 @@ The **-target** compiler option can be specified in one of four forms: [-target:winmdobj](./target-winmdobj-compiler-option.md) To create an intermediate .winmdobj file. - Unless you specify **-target:module**, **-target** causes a .NET Framework assembly manifest to be placed in an output file. For more information, see [Assemblies in .NET](../../../standard/assembly/index.md) and [Common Attributes](../../programming-guide/concepts/attributes/common-attributes.md). + Unless you specify **-target:module**, **-target** causes a .NET Framework assembly manifest to be placed in an output file. For more information, see [Assemblies in .NET](../../../standard/assembly/index.md) and [Common Attributes](../attributes/global.md). The assembly manifest is placed in the first .exe output file in the compilation or in the first DLL, if there is no .exe output file. For example, in the following command line, the manifest will be placed in `1.exe`: diff --git a/docs/csharp/misc/cs0243.md b/docs/csharp/misc/cs0243.md index 0a13ccc50af34..c24a65eb62549 100644 --- a/docs/csharp/misc/cs0243.md +++ b/docs/csharp/misc/cs0243.md @@ -7,15 +7,15 @@ helpviewer_keywords: - "CS0243" ms.assetid: 2506e4cb-dc26-46b4-a58c-ab6bf1601144 --- -# Compiler Error CS0243 +# Compiler error CS0243 The Conditional attribute is not valid on 'method' because it is an override method - The [Conditional](../programming-guide/concepts/attributes/common-attributes.md#Conditional) attribute is not allowed on a method that is marked with the [override](../language-reference/keywords/override.md) keyword. For more information, see [Knowing When to Use Override and New Keywords](../programming-guide/classes-and-structs/knowing-when-to-use-override-and-new-keywords.md). +The attribute is not allowed on a method that is marked with the [override](../language-reference/keywords/override.md) keyword. For more information, see [Knowing When to Use Override and New Keywords](../programming-guide/classes-and-structs/knowing-when-to-use-override-and-new-keywords.md). - The compiler never binds to override methods; it only binds to the base method and the common language runtime calls the override, as appropriate. +The compiler never binds to override methods. It only binds to the base method, and the common language runtime calls the override, as appropriate. - The following sample generates CS0243: +The following code generates CS0243: ```csharp // CS0243.cs diff --git a/docs/csharp/misc/cs0612.md b/docs/csharp/misc/cs0612.md index 618fa6906d080..52d05d95b6302 100644 --- a/docs/csharp/misc/cs0612.md +++ b/docs/csharp/misc/cs0612.md @@ -7,10 +7,11 @@ helpviewer_keywords: - "CS0612" ms.assetid: 7695f3b7-ffef-43f7-83db-fc1a9e361f1a --- -# Compiler Warning (level 1) CS0612 +# Compiler warning (level 1) CS0612 + 'member' is obsolete - The class designer marked a member with the [Obsolete](../programming-guide/concepts/attributes/common-attributes.md#Obsolete) attribute. This means that the member might not be supported in a future version of the class. + The class designer marked a member with the [Obsolete attribute](../language-reference/attributes/general.md#obsolete-attribute). This means that the member might not be supported in a future version of the class. The following sample shows how accessing an obsolete member generates CS0612: diff --git a/docs/csharp/misc/cs0629.md b/docs/csharp/misc/cs0629.md index 087f26433911d..c708f1f7ea7b2 100644 --- a/docs/csharp/misc/cs0629.md +++ b/docs/csharp/misc/cs0629.md @@ -7,12 +7,13 @@ helpviewer_keywords: - "CS0629" ms.assetid: 20f22ef0-3c6f-4108-ab09-3f0752375a10 --- -# Compiler Error CS0629 +# Compiler error CS0629 + Conditional member 'member' cannot implement interface member 'base class member' in type 'Type Name' - The [Conditional](../programming-guide/concepts/attributes/common-attributes.md#Conditional) attribute cannot be used on the implementation of an interface. +The [Conditional attribute](../language-reference/attributes/general.md#conditional-attribute) cannot be used on the implementation of an interface. - The following sample generates CS0629: +The following sample generates CS0629: ```csharp // CS0629.cs diff --git a/docs/csharp/programming-guide/concepts/attributes/index.md b/docs/csharp/programming-guide/concepts/attributes/index.md index 0146504a9e7aa..b684302948efd 100644 --- a/docs/csharp/programming-guide/concepts/attributes/index.md +++ b/docs/csharp/programming-guide/concepts/attributes/index.md @@ -75,7 +75,7 @@ The list of possible `target` values is shown in the following table. You would specify the `field` target value to apply an attribute to the backing field created for an [auto-implemented property](../../../properties.md). -The following example shows how to apply attributes to assemblies and modules. For more information, see [Common Attributes (C#)](common-attributes.md). +The following example shows how to apply attributes to assemblies and modules. For more information, see [Common Attributes (C#)](../../../language-reference/attributes/global.md). ```csharp using System; @@ -114,7 +114,7 @@ For more information, see: - [Creating Custom Attributes (C#)](creating-custom-attributes.md) - [Accessing Attributes by Using Reflection (C#)](accessing-attributes-by-using-reflection.md) - [How to create a C/C++ union by using attributes (C#)](how-to-create-a-c-cpp-union-by-using-attributes.md) -- [Common Attributes (C#)](common-attributes.md) +- [Common Attributes (C#)](../../../language-reference/attributes/global.md) - [Caller Information (C#)](../../../language-reference/attributes/caller-information.md) ## See also diff --git a/docs/csharp/programming-guide/concepts/collections.md b/docs/csharp/programming-guide/concepts/collections.md index 5b3ebb024284e..c3496e7afb6e2 100644 --- a/docs/csharp/programming-guide/concepts/collections.md +++ b/docs/csharp/programming-guide/concepts/collections.md @@ -596,7 +596,7 @@ private static IEnumerable EvenSequence( - [Programming Concepts (C#)](./index.md) - [Option Strict Statement](../../../visual-basic/language-reference/statements/option-strict-statement.md) - [LINQ to Objects (C#)](./linq/linq-to-objects.md) -- [Parallel LINQ (PLINQ)](../../../standard/parallel-programming/parallel-linq-plinq.md) +- [Parallel LINQ (PLINQ)](../../../standard/parallel-programming/introduction-to-plinq.md) - [Collections and Data Structures](../../../standard/collections/index.md) - [Selecting a Collection Class](../../../standard/collections/selecting-a-collection-class.md) - [Comparisons and Sorts Within Collections](../../../standard/collections/comparisons-and-sorts-within-collections.md) diff --git a/docs/csharp/toc.yml b/docs/csharp/toc.yml index 7a30ee502b8ad..793b6c594ccde 100644 --- a/docs/csharp/toc.yml +++ b/docs/csharp/toc.yml @@ -508,7 +508,7 @@ - name: "How to compute column values in a CSV text file (LINQ)" href: programming-guide/concepts/linq/how-to-compute-column-values-in-a-csv-text-file-linq.md - name: LINQ and Reflection - href: programming-guide/concepts/linq/linq-and-reflection.md + href: programming-guide/concepts/linq/how-to-query-an-assembly-s-metadata-with-reflection-linq.md - name: "How to query an assembly's metadata with Reflection (LINQ)" href: programming-guide/concepts/linq/how-to-query-an-assembly-s-metadata-with-reflection-linq.md - name: LINQ and File Directories diff --git a/docs/csharp/versioning.md b/docs/csharp/versioning.md index 627a39559ee90..0738462066909 100644 --- a/docs/csharp/versioning.md +++ b/docs/csharp/versioning.md @@ -39,7 +39,7 @@ Here are some things to consider when trying to maintain backwards compatibility will have to be updated. This is a huge breaking change and is strongly discouraged. - Method signatures: When updating a method behavior requires you to change its signature as well, you should instead create an overload so that code calling into that method will still work. You can always manipulate the old method signature to call into the new method signature so that implementation remains consistent. -- [Obsolete attribute](programming-guide/concepts/attributes/common-attributes.md#Obsolete): You can use this attribute in your code to specify classes or class members that are deprecated and likely to be removed in future versions. This ensures developers utilizing your library are better prepared for breaking changes. +- [Obsolete attribute](language-reference/attributes/general.md#obsolete-attribute): You can use this attribute in your code to specify classes or class members that are deprecated and likely to be removed in future versions. This ensures developers utilizing your library are better prepared for breaking changes. - Optional Method Arguments: When you make previously optional method arguments compulsory or change their default value then all code that does not supply those arguments will need to be updated. > [!NOTE] diff --git a/docs/visual-basic/developing-apps/programming/drives-directories-files/toc.yml b/docs/visual-basic/developing-apps/programming/drives-directories-files/toc.yml index 4457413b8b778..13dc93a652208 100644 --- a/docs/visual-basic/developing-apps/programming/drives-directories-files/toc.yml +++ b/docs/visual-basic/developing-apps/programming/drives-directories-files/toc.yml @@ -1,5 +1,5 @@ - name: Processing Drives, Directories, and Files - href: processing.md + href: index.md items: - name: File Access with Visual Basic href: file-access.md diff --git a/docs/visual-basic/language-reference/statements/declare-statement.md b/docs/visual-basic/language-reference/statements/declare-statement.md index 54763654c06c7..83ae76a33da1e 100644 --- a/docs/visual-basic/language-reference/statements/declare-statement.md +++ b/docs/visual-basic/language-reference/statements/declare-statement.md @@ -123,7 +123,7 @@ External references default to [Public](../../../visual-basic/language-reference - **Mechanism.** Visual Basic uses the .NET Framework *platform invoke* (PInvoke) mechanism to resolve and access external procedures. The `Declare` statement and the class both use this mechanism automatically, and you do not need any knowledge of PInvoke. For more information, see [Walkthrough: Calling Windows APIs](../../../visual-basic/programming-guide/com-interop/walkthrough-calling-windows-apis.md). > [!IMPORTANT] -> If the external procedure runs outside the common language runtime (CLR), it is *unmanaged code*. When you call such a procedure, for example a Windows API function or a COM method, you might expose your application to security risks. For more information, see [Secure Coding Guidelines for Unmanaged Code](../../../framework/security/secure-coding-guidelines-for-unmanaged-code.md). +> If the external procedure runs outside the common language runtime (CLR), it is *unmanaged code*. When you call such a procedure, for example a Windows API function or a COM method, you might expose your application to security risks. For more information, see [Secure Coding Guidelines for Unmanaged Code](https://docs.microsoft.com/previous-versions/dotnet/framework/security/secure-coding-guidelines-for-unmanaged-code). ## Example diff --git a/docs/visual-basic/misc/specified-registry-path-does-not-start-with-a-valid-hive-name.md b/docs/visual-basic/misc/specified-registry-path-does-not-start-with-a-valid-hive-name.md index 7cc6693892356..8ae0f335721f9 100644 --- a/docs/visual-basic/misc/specified-registry-path-does-not-start-with-a-valid-hive-name.md +++ b/docs/visual-basic/misc/specified-registry-path-does-not-start-with-a-valid-hive-name.md @@ -26,6 +26,6 @@ The specified registry path does not begin with a valid hive name. Valid hive na ## See also -- [Manipulating Strings](../../standard/base-types/manipulating-strings.md) +- [Manipulating Strings](../../standard/base-types/best-practices-strings.md) - [Reading from and Writing to the Registry (Visual Basic)](../developing-apps/programming/computer-resources/reading-from-and-writing-to-the-registry.md) - [My.Computer.Registry](xref:Microsoft.VisualBasic.MyServices.RegistryProxy) diff --git a/docs/visual-basic/programming-guide/concepts/collections.md b/docs/visual-basic/programming-guide/concepts/collections.md index 04cbdf169143c..90c35b377949a 100644 --- a/docs/visual-basic/programming-guide/concepts/collections.md +++ b/docs/visual-basic/programming-guide/concepts/collections.md @@ -568,7 +568,7 @@ End Function - [Programming Concepts (Visual Basic)](../../../visual-basic/programming-guide/concepts/index.md) - [Option Strict Statement](../../../visual-basic/language-reference/statements/option-strict-statement.md) - [LINQ to Objects (Visual Basic)](../../../visual-basic/programming-guide/concepts/linq/linq-to-objects.md) -- [Parallel LINQ (PLINQ)](../../../standard/parallel-programming/parallel-linq-plinq.md) +- [Parallel LINQ (PLINQ)](../../../standard/parallel-programming/introduction-to-plinq.md) - [Collections and Data Structures](../../../standard/collections/index.md) - [Selecting a Collection Class](../../../standard/collections/selecting-a-collection-class.md) - [Comparisons and Sorts Within Collections](../../../standard/collections/comparisons-and-sorts-within-collections.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/toc.yml b/docs/visual-basic/programming-guide/concepts/linq/toc.yml index c526c6adb1348..f03a5971730c8 100644 --- a/docs/visual-basic/programming-guide/concepts/linq/toc.yml +++ b/docs/visual-basic/programming-guide/concepts/linq/toc.yml @@ -295,7 +295,7 @@ href: linq-to-xml-for-xpath-users.md items: - name: Comparison of XPath and LINQ to XML - href: comparison-of-xpath-and-linq-to-xml.md + href: ../../../../csharp/programming-guide/concepts/linq/comparison-of-xpath-and-linq-to-xml.md - name: "How to: Find a Child Element (XPath-LINQ to XML)" href: how-to-find-a-child-element-xpath-linq-to-xml.md - name: "How to: Find a List of Child Elements (XPath-LINQ to XML)" diff --git a/docs/visual-basic/programming-guide/language-features/strings/how-to-create-strings-using-a-stringbuilder.md b/docs/visual-basic/programming-guide/language-features/strings/how-to-create-strings-using-a-stringbuilder.md index 83804153c5bc4..5285799ba994b 100644 --- a/docs/visual-basic/programming-guide/language-features/strings/how-to-create-strings-using-a-stringbuilder.md +++ b/docs/visual-basic/programming-guide/language-features/strings/how-to-create-strings-using-a-stringbuilder.md @@ -22,4 +22,4 @@ The following example creates an instance of the Date: Fri, 17 Apr 2020 12:36:30 -0700 Subject: [PATCH 7/9] revert to intentional redirect (#17920) --- docs/welcome.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/welcome.md b/docs/welcome.md index 86e5e8e625eaf..dad40f7ad4309 100644 --- a/docs/welcome.md +++ b/docs/welcome.md @@ -29,7 +29,7 @@ For information about the latest features added to the .NET implementations and - [What's new in .NET Core 3.1](core/whats-new/dotnet-core-3-1.md) - [What's new in the .NET Framework](framework/whats-new/index.md) -- [What's new in C#](csharp/whats-new/csharp-8.md) +- [What's new in C#](csharp/whats-new/index.md) - [What's new for Visual Basic](visual-basic/getting-started/whats-new.md) ## Documentation From 930b13be9ea1147b106342e045176356b32d6810 Mon Sep 17 00:00:00 2001 From: Andy De George <2672110+Thraka@users.noreply.github.com> Date: Fri, 17 Apr 2020 12:43:22 -0700 Subject: [PATCH 8/9] Change message wording (#17894) --- docs/core/install/linux-package-manager-centos7.md | 6 +++--- docs/core/install/linux-package-manager-debian10.md | 6 +++--- docs/core/install/linux-package-manager-debian9.md | 6 +++--- docs/core/install/linux-package-manager-fedora29.md | 6 +++--- docs/core/install/linux-package-manager-fedora30.md | 6 +++--- docs/core/install/linux-package-manager-fedora31.md | 6 +++--- docs/core/install/linux-package-manager-opensuse15.md | 6 +++--- docs/core/install/linux-package-manager-sles12.md | 6 +++--- docs/core/install/linux-package-manager-sles15.md | 6 +++--- docs/core/install/linux-package-manager-ubuntu-1604.md | 6 +++--- docs/core/install/linux-package-manager-ubuntu-1804.md | 6 +++--- docs/core/install/linux-package-manager-ubuntu-1904.md | 6 +++--- docs/core/install/linux-package-manager-ubuntu-1910.md | 6 +++--- 13 files changed, 39 insertions(+), 39 deletions(-) diff --git a/docs/core/install/linux-package-manager-centos7.md b/docs/core/install/linux-package-manager-centos7.md index c448c2c4f9e08..b83a3d6e98f91 100644 --- a/docs/core/install/linux-package-manager-centos7.md +++ b/docs/core/install/linux-package-manager-centos7.md @@ -14,12 +14,12 @@ This article describes how to use a package manager to install .NET Core on Cent [!INCLUDE [package-manager-intro-sdk-vs-runtime](includes/package-manager-intro-sdk-vs-runtime.md)] -## Register Microsoft key and feed +## Add Microsoft repository key and feed Before installing .NET, you'll need to: -- Register the Microsoft key. -- Register the product repository. +- Add the Microsoft package signing key to the list of trusted keys. +- Add the repository to the package manager. - Install required dependencies. This only needs to be done once per machine. diff --git a/docs/core/install/linux-package-manager-debian10.md b/docs/core/install/linux-package-manager-debian10.md index 7fcd7513d3f09..b5a479b9a0914 100644 --- a/docs/core/install/linux-package-manager-debian10.md +++ b/docs/core/install/linux-package-manager-debian10.md @@ -14,12 +14,12 @@ This article describes how to use a package manager to install .NET Core on Debi [!INCLUDE [package-manager-intro-sdk-vs-runtime](includes/package-manager-intro-sdk-vs-runtime.md)] -## Register Microsoft key and feed +## Add Microsoft repository key and feed Before installing .NET, you'll need to: -- Register the Microsoft key. -- Register the product repository. +- Add the Microsoft package signing key to the list of trusted keys. +- Add the repository to the package manager. - Install required dependencies. This only needs to be done once per machine. diff --git a/docs/core/install/linux-package-manager-debian9.md b/docs/core/install/linux-package-manager-debian9.md index 9ffb731e55b6d..83969b40f580b 100644 --- a/docs/core/install/linux-package-manager-debian9.md +++ b/docs/core/install/linux-package-manager-debian9.md @@ -14,12 +14,12 @@ This article describes how to use a package manager to install .NET Core on Debi [!INCLUDE [package-manager-intro-sdk-vs-runtime](includes/package-manager-intro-sdk-vs-runtime.md)] -## Register Microsoft key and feed +## Add Microsoft repository key and feed Before installing .NET, you'll need to: -- Register the Microsoft key. -- Register the product repository. +- Add the Microsoft package signing key to the list of trusted keys. +- Add the repository to the package manager. - Install required dependencies. This only needs to be done once per machine. diff --git a/docs/core/install/linux-package-manager-fedora29.md b/docs/core/install/linux-package-manager-fedora29.md index dd8a4e889c6e4..4ccf697fd4ac0 100644 --- a/docs/core/install/linux-package-manager-fedora29.md +++ b/docs/core/install/linux-package-manager-fedora29.md @@ -14,12 +14,12 @@ This article describes how to use a package manager to install .NET Core on Fedo [!INCLUDE [package-manager-intro-sdk-vs-runtime](includes/package-manager-intro-sdk-vs-runtime.md)] -## Register Microsoft key and feed +## Add Microsoft repository key and feed Before installing .NET, you'll need to: -- Register the Microsoft key. -- Register the product repository. +- Add the Microsoft package signing key to the list of trusted keys. +- Add the repository to the package manager. - Install required dependencies. This only needs to be done once per machine. diff --git a/docs/core/install/linux-package-manager-fedora30.md b/docs/core/install/linux-package-manager-fedora30.md index 42b49e25450f0..5724b035fd958 100644 --- a/docs/core/install/linux-package-manager-fedora30.md +++ b/docs/core/install/linux-package-manager-fedora30.md @@ -14,12 +14,12 @@ This article describes how to use a package manager to install .NET Core on Fedo [!INCLUDE [package-manager-intro-sdk-vs-runtime](includes/package-manager-intro-sdk-vs-runtime.md)] -## Register Microsoft key and feed +## Add Microsoft repository key and feed Before installing .NET, you'll need to: -- Register the Microsoft key. -- Register the product repository. +- Add the Microsoft package signing key to the list of trusted keys. +- Add the repository to the package manager. - Install required dependencies. This only needs to be done once per machine. diff --git a/docs/core/install/linux-package-manager-fedora31.md b/docs/core/install/linux-package-manager-fedora31.md index 023f323ca60a4..79f0e463528a6 100644 --- a/docs/core/install/linux-package-manager-fedora31.md +++ b/docs/core/install/linux-package-manager-fedora31.md @@ -14,12 +14,12 @@ This article describes how to use a package manager to install .NET Core on Fedo [!INCLUDE [package-manager-intro-sdk-vs-runtime](includes/package-manager-intro-sdk-vs-runtime.md)] -## Register Microsoft key and feed +## Add Microsoft repository key and feed Before installing .NET, you'll need to: -- Register the Microsoft key. -- Register the product repository. +- Add the Microsoft package signing key to the list of trusted keys. +- Add the repository to the package manager. - Install required dependencies. This only needs to be done once per machine. diff --git a/docs/core/install/linux-package-manager-opensuse15.md b/docs/core/install/linux-package-manager-opensuse15.md index b286648214fe1..2dab690947352 100644 --- a/docs/core/install/linux-package-manager-opensuse15.md +++ b/docs/core/install/linux-package-manager-opensuse15.md @@ -14,12 +14,12 @@ This article describes how to use a package manager to install .NET Core on open [!INCLUDE [package-manager-intro-sdk-vs-runtime](includes/package-manager-intro-sdk-vs-runtime.md)] -## Register Microsoft key and feed +## Add Microsoft repository key and feed Before installing .NET, you'll need to: -- Register the Microsoft key. -- Register the product repository. +- Add the Microsoft package signing key to the list of trusted keys. +- Add the repository to the package manager. - Install required dependencies. This only needs to be done once per machine. diff --git a/docs/core/install/linux-package-manager-sles12.md b/docs/core/install/linux-package-manager-sles12.md index 3530d18b48a44..0da3e03de4c5b 100644 --- a/docs/core/install/linux-package-manager-sles12.md +++ b/docs/core/install/linux-package-manager-sles12.md @@ -14,12 +14,12 @@ This article describes how to use a package manager to install .NET Core on SLES [!INCLUDE [package-manager-intro-sdk-vs-runtime](includes/package-manager-intro-sdk-vs-runtime.md)] -## Register Microsoft key and feed +## Add Microsoft repository key and feed Before installing .NET, you'll need to: -- Register the Microsoft key. -- Register the product repository. +- Add the Microsoft package signing key to the list of trusted keys. +- Add the repository to the package manager. - Install required dependencies. This only needs to be done once per machine. diff --git a/docs/core/install/linux-package-manager-sles15.md b/docs/core/install/linux-package-manager-sles15.md index 17e856a161587..49c8d78239e21 100644 --- a/docs/core/install/linux-package-manager-sles15.md +++ b/docs/core/install/linux-package-manager-sles15.md @@ -14,12 +14,12 @@ This article describes how to use a package manager to install .NET Core on SLES [!INCLUDE [package-manager-intro-sdk-vs-runtime](includes/package-manager-intro-sdk-vs-runtime.md)] -## Register Microsoft key and feed +## Add Microsoft repository key and feed Before installing .NET, you'll need to: -- Register the Microsoft key. -- Register the product repository. +- Add the Microsoft package signing key to the list of trusted keys. +- Add the repository to the package manager. - Install required dependencies. This only needs to be done once per machine. diff --git a/docs/core/install/linux-package-manager-ubuntu-1604.md b/docs/core/install/linux-package-manager-ubuntu-1604.md index 493696cf8a810..e3eec8a028990 100644 --- a/docs/core/install/linux-package-manager-ubuntu-1604.md +++ b/docs/core/install/linux-package-manager-ubuntu-1604.md @@ -14,12 +14,12 @@ This article describes how to use a package manager to install .NET Core on Ubun [!INCLUDE [package-manager-intro-sdk-vs-runtime](includes/package-manager-intro-sdk-vs-runtime.md)] -## Register Microsoft key and feed +## Add Microsoft repository key and feed Before installing .NET, you'll need to: -- Register the Microsoft key. -- Register the product repository. +- Add the Microsoft package signing key to the list of trusted keys. +- Add the repository to the package manager. - Install required dependencies. This only needs to be done once per machine. diff --git a/docs/core/install/linux-package-manager-ubuntu-1804.md b/docs/core/install/linux-package-manager-ubuntu-1804.md index f41e8e97605cb..735f65fd713a6 100644 --- a/docs/core/install/linux-package-manager-ubuntu-1804.md +++ b/docs/core/install/linux-package-manager-ubuntu-1804.md @@ -14,12 +14,12 @@ This article describes how to use a package manager to install .NET Core on Ubun [!INCLUDE [package-manager-intro-sdk-vs-runtime](includes/package-manager-intro-sdk-vs-runtime.md)] -## Register Microsoft key and feed +## Add Microsoft repository key and feed Before installing .NET, you'll need to: -- Register the Microsoft key. -- Register the product repository. +- Add the Microsoft package signing key to the list of trusted keys. +- Add the repository to the package manager. - Install required dependencies. This only needs to be done once per machine. diff --git a/docs/core/install/linux-package-manager-ubuntu-1904.md b/docs/core/install/linux-package-manager-ubuntu-1904.md index 5274e845702fe..64ba9675ae301 100644 --- a/docs/core/install/linux-package-manager-ubuntu-1904.md +++ b/docs/core/install/linux-package-manager-ubuntu-1904.md @@ -14,12 +14,12 @@ This article describes how to use a package manager to install .NET Core on Ubun [!INCLUDE [package-manager-intro-sdk-vs-runtime](includes/package-manager-intro-sdk-vs-runtime.md)] -## Register Microsoft key and feed +## Add Microsoft repository key and feed Before installing .NET, you'll need to: -- Register the Microsoft key. -- Register the product repository. +- Add the Microsoft package signing key to the list of trusted keys. +- Add the repository to the package manager. - Install required dependencies. This only needs to be done once per machine. diff --git a/docs/core/install/linux-package-manager-ubuntu-1910.md b/docs/core/install/linux-package-manager-ubuntu-1910.md index 01b36cdced4ca..138ec3e7af00f 100644 --- a/docs/core/install/linux-package-manager-ubuntu-1910.md +++ b/docs/core/install/linux-package-manager-ubuntu-1910.md @@ -14,12 +14,12 @@ This article describes how to use a package manager to install .NET Core on Ubun [!INCLUDE [package-manager-intro-sdk-vs-runtime](includes/package-manager-intro-sdk-vs-runtime.md)] -## Register Microsoft key and feed +## Add Microsoft repository key and feed Before installing .NET, you'll need to: -- Register the Microsoft key. -- Register the product repository. +- Add the Microsoft package signing key to the list of trusted keys. +- Add the repository to the package manager. - Install required dependencies. This only needs to be done once per machine. From b020ed352364072ef7b65f13649c3fad88b04521 Mon Sep 17 00:00:00 2001 From: Andy De George <2672110+Thraka@users.noreply.github.com> Date: Fri, 17 Apr 2020 12:43:58 -0700 Subject: [PATCH 9/9] Added a new section related to install folders (#17870) * Added a new section related to install folders * Fix syntax --- .../how-to-detect-installed-versions.md | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/docs/core/install/how-to-detect-installed-versions.md b/docs/core/install/how-to-detect-installed-versions.md index 4dd2e473138c6..3e41573779eee 100644 --- a/docs/core/install/how-to-detect-installed-versions.md +++ b/docs/core/install/how-to-detect-installed-versions.md @@ -161,6 +161,51 @@ Microsoft.NETCore.App 3.1.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.Ap ::: zone-end +## Check for install folders + +It's possible that .NET Core is installed but not added to the `PATH` variable for your operating system or user profile. Running the commands from the previous sections may not work. As an alternative, you can check that the .NET Core install folders exist. + +When you install .NET Core from an installer or script, it's installed to a standard folder. Much of the time the installer or script you're using to install .NET Core gives you an option to install to a different folder. If you choose to install to a different folder, adjust the start of the folder path. + +::: zone pivot="os-windows" + +- **dotnet executable**\ +_C:\\program files\\dotnet\\dotnet.exe_ + +- **.NET SDK**\ +_C:\\program files\\dotnet\\sdk\\{version}\\_ + +- **.NET Runtime**\ +_C:\\program files\\dotnet\\shared\\{runtime-type}\\{version}\\_ + +::: zone-end + +::: zone pivot="os-linux" + +- **dotnet executable**\ +_/home/user/share/dotnet/dotnet_ + +- **.NET SDK**\ +_/home/user/share/dotnet/sdk/{version}/_ + +- **.NET Runtime**\ +_/home/user/share/dotnet/shared/{runtime-type}/{version}/_ + +::: zone-end + +::: zone pivot="os-macos" + +- **dotnet executable**\ +_/usr/local/share/dotnet/dotnet_ + +- **.NET SDK**\ +_/usr/local/share/dotnet/sdk/{version}/_ + +- **.NET Runtime**\ +_/usr/local/share/dotnet/shared/{runtime-type}/{version}/_ + +::: zone-end + ## More information You can see both the SDK versions and runtime versions with the command `dotnet --info`. You'll also get other environmental related information, such as the operating system version and runtime identifier (RID).