Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / Log / System / IO / Log / PolicyUnit.cs / 1 / PolicyUnit.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.IO.Log { using System; using System.Globalization; public struct PolicyUnit { PolicyUnitType type; long value; public PolicyUnit(long value, PolicyUnitType type) { if (type == PolicyUnitType.Percentage) { if ((value < 0) || (value > 100)) throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(Error.ArgumentOutOfRange("value")); } else if (type == PolicyUnitType.Extents) { if (value < 0) throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(Error.ArgumentOutOfRange("value")); } else { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(Error.ArgumentOutOfRange("type")); } this.type = type; this.value = value; } public PolicyUnitType Type { get { return this.type; } } public long Value { get { return this.value; } } public override int GetHashCode() { return (this.type.GetHashCode() ^ this.value.GetHashCode()); } public override bool Equals(object obj) { if (!(obj is PolicyUnit)) return false; PolicyUnit other = (PolicyUnit)(obj); return this == other; } public static bool operator ==(PolicyUnit left, PolicyUnit right) { return ((left.type == right.type) && (left.value == right.value)); } public static bool operator !=(PolicyUnit left, PolicyUnit right) { return !(left == right); } public static PolicyUnit Percentage(long value) { return new PolicyUnit(value, PolicyUnitType.Percentage); } public static PolicyUnit Extents(long value) { return new PolicyUnit(value, PolicyUnitType.Extents); } public override string ToString() { if (this.type == PolicyUnitType.Percentage) { return SR.GetString(SR.PolicyUnit_Percent, this.value); } else { return SR.GetString(SR.PolicyUnit_Extents, this.value); } } } } // 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
- QueryContinueDragEventArgs.cs
- UnmanagedHandle.cs
- WebServiceErrorEvent.cs
- XmlDataSourceNodeDescriptor.cs
- GridPatternIdentifiers.cs
- SqlProfileProvider.cs
- CopyEncoder.cs
- ProfileGroupSettingsCollection.cs
- ConfigXmlCDataSection.cs
- FunctionParameter.cs
- NotFiniteNumberException.cs
- ApplicationSettingsBase.cs
- Binding.cs
- AccessibleObject.cs
- _AutoWebProxyScriptEngine.cs
- XmlDocumentType.cs
- ContainerActivationHelper.cs
- SchemaExporter.cs
- ContentType.cs
- _LoggingObject.cs
- TypefaceCollection.cs
- IndependentlyAnimatedPropertyMetadata.cs
- FrameworkContentElement.cs
- TemplatedWizardStep.cs
- TextParagraphView.cs
- ProxyDataContractResolver.cs
- ScaleTransform3D.cs
- PackUriHelper.cs
- DecimalFormatter.cs
- SecurityTokenValidationException.cs
- VisualProxy.cs
- XmlMapping.cs
- XmlNavigatorStack.cs
- ConstNode.cs
- RawStylusInputCustomDataList.cs
- PackUriHelper.cs
- ZipIOFileItemStream.cs
- ResourcePermissionBase.cs
- ToolBarOverflowPanel.cs
- ResourceReferenceKeyNotFoundException.cs
- XmlUtil.cs
- MimePart.cs
- Separator.cs
- ChangeToolStripParentVerb.cs
- FreezableDefaultValueFactory.cs
- TextCompositionManager.cs
- AsyncStreamReader.cs
- X509ChainElement.cs
- ToolStripArrowRenderEventArgs.cs
- DropDownList.cs
- _Rfc2616CacheValidators.cs
- TextDecoration.cs
- HtmlElementEventArgs.cs
- XmlCountingReader.cs
- DataSourceNameHandler.cs
- safelinkcollection.cs
- Page.cs
- ReadOnlyCollectionBase.cs
- SchemaTableOptionalColumn.cs
- TransformationRules.cs
- MissingMethodException.cs
- BaseTreeIterator.cs
- DomNameTable.cs
- CodeCatchClause.cs
- ApplicationHost.cs
- MoveSizeWinEventHandler.cs
- CTreeGenerator.cs
- TdsParserSessionPool.cs
- PackagePartCollection.cs
- Attachment.cs
- UIElementParaClient.cs
- _ReceiveMessageOverlappedAsyncResult.cs
- GridViewColumnHeader.cs
- EdmToObjectNamespaceMap.cs
- ExtensionFile.cs
- PartialCachingControl.cs
- BypassElementCollection.cs
- CellCreator.cs
- PenThread.cs
- EndEvent.cs
- StackOverflowException.cs
- FastEncoderWindow.cs
- DataTemplate.cs
- PassportAuthentication.cs
- EventLogInformation.cs
- BatchServiceHost.cs
- SQLBinary.cs
- Debug.cs
- DataGridTableCollection.cs
- Setter.cs
- CursorInteropHelper.cs
- SetIndexBinder.cs
- SqlDataSource.cs
- AsymmetricKeyExchangeFormatter.cs
- XPathDescendantIterator.cs
- MouseEvent.cs
- OleDbRowUpdatingEvent.cs
- StringResourceManager.cs
- DataRecordInfo.cs
- DataGridViewRowsAddedEventArgs.cs