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
- EventLog.cs
- RootBuilder.cs
- BaseTemplateCodeDomTreeGenerator.cs
- HwndSourceKeyboardInputSite.cs
- FlowchartStart.xaml.cs
- MobilePage.cs
- DecoratedNameAttribute.cs
- NaturalLanguageHyphenator.cs
- X509AsymmetricSecurityKey.cs
- DoWorkEventArgs.cs
- ConnectionProviderAttribute.cs
- ErrorTableItemStyle.cs
- IncrementalReadDecoders.cs
- securitymgrsite.cs
- CacheDependency.cs
- CqlBlock.cs
- TableParaClient.cs
- prompt.cs
- BindMarkupExtensionSerializer.cs
- KeyGesture.cs
- TemplateControl.cs
- DBAsyncResult.cs
- Pen.cs
- BaseCollection.cs
- ObsoleteAttribute.cs
- SqlMethodTransformer.cs
- OrderedDictionary.cs
- EdmSchemaError.cs
- HwndSourceParameters.cs
- ConcurrentQueue.cs
- DataKeyArray.cs
- LexicalChunk.cs
- DoWorkEventArgs.cs
- D3DImage.cs
- RotateTransform.cs
- MessageHeaderException.cs
- ComponentCollection.cs
- ParenthesizePropertyNameAttribute.cs
- ReadOnlyDictionary.cs
- DecoderExceptionFallback.cs
- WorkflowStateRollbackService.cs
- ConnectionManagementElementCollection.cs
- NamespaceInfo.cs
- HiddenFieldPageStatePersister.cs
- ViewStateModeByIdAttribute.cs
- StringUtil.cs
- DataSourceView.cs
- GlobalizationAssembly.cs
- ISFTagAndGuidCache.cs
- RouteCollection.cs
- SmiRecordBuffer.cs
- ObjectListSelectEventArgs.cs
- DateTimeFormatInfoScanner.cs
- AdapterDictionary.cs
- DeferredTextReference.cs
- ZipIOCentralDirectoryFileHeader.cs
- CharStorage.cs
- EntityExpressionVisitor.cs
- DataAccessor.cs
- SafeNativeMethodsOther.cs
- WorkflowItemPresenter.cs
- AppModelKnownContentFactory.cs
- DynamicDataManager.cs
- CodeExpressionCollection.cs
- ReceiveContext.cs
- Mapping.cs
- EntityClientCacheKey.cs
- WebPartConnectionsConfigureVerb.cs
- TargetException.cs
- Soap.cs
- ThicknessAnimation.cs
- StructuralComparisons.cs
- PathSegmentCollection.cs
- SqlFormatter.cs
- MessageQueue.cs
- StringOutput.cs
- DockAndAnchorLayout.cs
- ScopedKnownTypes.cs
- PersonalizationEntry.cs
- Relationship.cs
- SplitContainerDesigner.cs
- ProxyAttribute.cs
- DataContract.cs
- ListenUriMode.cs
- TypeSystem.cs
- AppSettingsReader.cs
- _ProxyRegBlob.cs
- FontConverter.cs
- QilValidationVisitor.cs
- BulletedListEventArgs.cs
- PolicyException.cs
- XPathNodeHelper.cs
- RoutedCommand.cs
- AuthenticationManager.cs
- TreeNodeCollection.cs
- TreeNodeBinding.cs
- Queue.cs
- IdentityHolder.cs
- GlyphsSerializer.cs
- Activator.cs