Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / WCF / Log / System / IO / Log / PolicyUnit.cs / 1305376 / 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- SchemaImporterExtensionsSection.cs
- MachineSettingsSection.cs
- RadioButtonBaseAdapter.cs
- BreakRecordTable.cs
- DbConnectionPoolGroup.cs
- FindCriteriaCD1.cs
- UserValidatedEventArgs.cs
- CheckBoxList.cs
- QilStrConcat.cs
- ApplicationSecurityManager.cs
- PrivilegedConfigurationManager.cs
- ScopelessEnumAttribute.cs
- Geometry.cs
- AcceptorSessionSymmetricMessageSecurityProtocol.cs
- WebResourceUtil.cs
- QueryContinueDragEventArgs.cs
- ChtmlTextWriter.cs
- XamlTreeBuilder.cs
- GridViewColumnCollection.cs
- DateTimeUtil.cs
- ForceCopyBuildProvider.cs
- ObjectTokenCategory.cs
- SiteOfOriginPart.cs
- FixedStringLookup.cs
- MetadataItemEmitter.cs
- Debugger.cs
- HandlerBase.cs
- TimeIntervalCollection.cs
- ContextQuery.cs
- ResourceDefaultValueAttribute.cs
- cache.cs
- DbDataSourceEnumerator.cs
- SslSecurityTokenParameters.cs
- CurrencyManager.cs
- HistoryEventArgs.cs
- ListViewUpdatedEventArgs.cs
- Blend.cs
- ModulesEntry.cs
- AutomationProperties.cs
- SQLResource.cs
- TextParagraphCache.cs
- WebPartConnectionsConnectVerb.cs
- HtmlUtf8RawTextWriter.cs
- WebErrorHandler.cs
- TreeViewHitTestInfo.cs
- DetailsViewDeleteEventArgs.cs
- WebEventCodes.cs
- TextProperties.cs
- EndpointAddressElementBase.cs
- Simplifier.cs
- BrowserDefinitionCollection.cs
- RegexMatch.cs
- ScalarOps.cs
- QuaternionAnimation.cs
- ProcessManager.cs
- EnumMember.cs
- CustomTypeDescriptor.cs
- AssertSection.cs
- UpnEndpointIdentity.cs
- QueryException.cs
- SoapIncludeAttribute.cs
- WebFormDesignerActionService.cs
- HMACMD5.cs
- VerbConverter.cs
- UnmanagedMemoryStreamWrapper.cs
- TagMapInfo.cs
- WsatTransactionInfo.cs
- DirectionalLight.cs
- ReflectEventDescriptor.cs
- WpfGeneratedKnownTypes.cs
- TextDataBindingHandler.cs
- SqlDataSourceWizardForm.cs
- BinarySecretKeyIdentifierClause.cs
- ApplicationCommands.cs
- COM2PropertyDescriptor.cs
- SimpleParser.cs
- Rect.cs
- MarkupExtensionReturnTypeAttribute.cs
- OrderByQueryOptionExpression.cs
- APCustomTypeDescriptor.cs
- UnsafeNativeMethodsMilCoreApi.cs
- ImageKeyConverter.cs
- GridViewSelectEventArgs.cs
- TypeBuilder.cs
- FatalException.cs
- NotSupportedException.cs
- RequestBringIntoViewEventArgs.cs
- TextRenderer.cs
- StringComparer.cs
- CustomAttributeFormatException.cs
- HMAC.cs
- HashCodeCombiner.cs
- Label.cs
- CqlErrorHelper.cs
- ListViewContainer.cs
- DoubleLinkList.cs
- Int32Collection.cs
- FixedElement.cs
- RC2CryptoServiceProvider.cs
- JobStaple.cs