Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Core / Microsoft / Scripting / Ast / SwitchCase.cs / 1305376 / SwitchCase.cs
/* **************************************************************************** * * Copyright (c) Microsoft Corporation. * * This source code is subject to terms and conditions of the Microsoft Public License. A * copy of the license can be found in the License.html file at the root of this distribution. If * you cannot locate the Microsoft Public License, please send an email to * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound * by the terms of the Microsoft Public License. * * You must not remove this notice, or any other, from this software. * * * ***************************************************************************/ using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; using System.Dynamic.Utils; namespace System.Linq.Expressions { ////// Represents one case of a #if !SILVERLIGHT [DebuggerTypeProxy(typeof(Expression.SwitchCaseProxy))] #endif public sealed class SwitchCase { private readonly ReadOnlyCollection. /// _testValues; private readonly Expression _body; internal SwitchCase(Expression body, ReadOnlyCollection testValues) { _body = body; _testValues = testValues; } /// /// Gets the values of this case. This case is selected for execution when the public ReadOnlyCollectionmatches any of these values. /// TestValues { get { return _testValues; } } /// /// Gets the body of this case. /// public Expression Body { get { return _body; } } ////// Returns a ///that represents the current . /// A public override string ToString() { return ExpressionStringBuilder.SwitchCaseToString(this); } ///that represents the current . /// Creates a new expression that is like this one, but using the /// supplied children. If all of the children are the same, it will /// return this expression. /// /// Theproperty of the result. /// The property of the result. /// This expression if no children changed, or an expression with the updated children. public SwitchCase Update(IEnumerabletestValues, Expression body) { if (testValues == TestValues && body == Body) { return this; } return Expression.SwitchCase(body, testValues); } } public partial class Expression { /// /// Creates a /// The body of the case. /// The test values of the case. ///SwitchCase for use in a. /// The created public static SwitchCase SwitchCase(Expression body, params Expression[] testValues) { return SwitchCase(body, (IEnumerableSwitchCase .)testValues); } /// /// Creates a /// The body of the case. /// The test values of the case. ///SwitchCase for use in a. /// The created public static SwitchCase SwitchCase(Expression body, IEnumerableSwitchCase .testValues) { RequiresCanRead(body, "body"); var values = testValues.ToReadOnly(); RequiresCanRead(values, "testValues"); ContractUtils.RequiresNotEmpty(values, "testValues"); return new SwitchCase(body, values); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- SortQuery.cs
- TypeCollectionPropertyEditor.cs
- BindingUtils.cs
- WebBrowserUriTypeConverter.cs
- HtmlShimManager.cs
- NamespaceQuery.cs
- SQLBinary.cs
- QilList.cs
- WebPartConnectionCollection.cs
- FileLoadException.cs
- UIElementAutomationPeer.cs
- ArrangedElement.cs
- TraceSource.cs
- StringResourceManager.cs
- ReaderContextStackData.cs
- FileDialog_Vista_Interop.cs
- DetailsViewUpdateEventArgs.cs
- ZipIOExtraField.cs
- EntityDataSourceChangingEventArgs.cs
- XmlBufferReader.cs
- Serializer.cs
- RangeValidator.cs
- VectorAnimationUsingKeyFrames.cs
- RIPEMD160Managed.cs
- TextBoxAutomationPeer.cs
- FormViewCommandEventArgs.cs
- TypefaceMap.cs
- ColumnBinding.cs
- PeerApplicationLaunchInfo.cs
- ItemAutomationPeer.cs
- NavigationExpr.cs
- GridItem.cs
- ShapeTypeface.cs
- SchemaElementLookUpTable.cs
- TablePattern.cs
- BindableTemplateBuilder.cs
- MetadataException.cs
- MaterialCollection.cs
- XmlValueConverter.cs
- x509store.cs
- TimersDescriptionAttribute.cs
- TimeManager.cs
- Axis.cs
- XmlSchemaAll.cs
- PenCursorManager.cs
- Sentence.cs
- GCHandleCookieTable.cs
- ClientWindowsAuthenticationMembershipProvider.cs
- ComponentSerializationService.cs
- PassportIdentity.cs
- FileInfo.cs
- XmlUrlResolver.cs
- Funcletizer.cs
- MetadataItemEmitter.cs
- OverrideMode.cs
- RefreshResponseInfo.cs
- Main.cs
- WinFormsComponentEditor.cs
- TextModifier.cs
- TraceSection.cs
- TextDocumentView.cs
- Claim.cs
- RenamedEventArgs.cs
- QueryOptionExpression.cs
- DispatchWrapper.cs
- Attributes.cs
- DecoderNLS.cs
- Dispatcher.cs
- TableLayout.cs
- MsmqHostedTransportManager.cs
- AuthenticatedStream.cs
- AttributeEmitter.cs
- And.cs
- NotFiniteNumberException.cs
- SqlDataSourceCommandParser.cs
- ClickablePoint.cs
- CommonXSendMessage.cs
- BitConverter.cs
- ListBindingHelper.cs
- EntityProxyTypeInfo.cs
- ServiceSecurityAuditBehavior.cs
- DeploymentSection.cs
- LocatorGroup.cs
- XPathAxisIterator.cs
- DateTimeOffsetConverter.cs
- ChameleonKey.cs
- WorkflowPersistenceContext.cs
- ServiceChannelProxy.cs
- BoundColumn.cs
- VectorAnimationUsingKeyFrames.cs
- DbConnectionOptions.cs
- HtmlInputHidden.cs
- TextRunCache.cs
- ParameterModifier.cs
- PrintPreviewControl.cs
- _ChunkParse.cs
- NativeActivityFaultContext.cs
- FacetValueContainer.cs
- CalendarTable.cs
- ScriptRef.cs