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
- TransactedBatchingElement.cs
- EntityContainerEntitySet.cs
- Scene3D.cs
- Code.cs
- EditorPart.cs
- ADMembershipUser.cs
- TypeSource.cs
- SmiContext.cs
- MultilineStringEditor.cs
- WebException.cs
- HttpConfigurationSystem.cs
- OleDbParameter.cs
- Int32Collection.cs
- PackageRelationshipSelector.cs
- ColumnMapTranslator.cs
- IndexedDataBuffer.cs
- ManagementEventArgs.cs
- Transform3DCollection.cs
- MatrixCamera.cs
- ThreadWorkerController.cs
- StringFormat.cs
- FontStretchConverter.cs
- MetadataSerializer.cs
- CompilerWrapper.cs
- COM2AboutBoxPropertyDescriptor.cs
- RangeValueProviderWrapper.cs
- UnicodeEncoding.cs
- XmlSerializerFaultFormatter.cs
- ReferencedType.cs
- AddIn.cs
- SoapServerMessage.cs
- IgnoreSectionHandler.cs
- VectorAnimation.cs
- ShowExpandedMultiValueConverter.cs
- DesigntimeLicenseContextSerializer.cs
- FormViewModeEventArgs.cs
- Variant.cs
- DrawingDrawingContext.cs
- UrlAuthorizationModule.cs
- HMAC.cs
- SQLDateTime.cs
- Page.cs
- NullableDoubleSumAggregationOperator.cs
- CategoryGridEntry.cs
- TextAnchor.cs
- DataGridItem.cs
- ScriptServiceAttribute.cs
- CustomValidator.cs
- Calendar.cs
- TextWriterTraceListener.cs
- xdrvalidator.cs
- BinHexEncoding.cs
- ConstraintConverter.cs
- Trace.cs
- CheckableControlBaseAdapter.cs
- ComplexLine.cs
- PatternMatcher.cs
- XmlSerializerVersionAttribute.cs
- TextParentUndoUnit.cs
- PageRanges.cs
- UnicodeEncoding.cs
- TextElementEditingBehaviorAttribute.cs
- CommandField.cs
- SortDescription.cs
- ProfilePropertySettings.cs
- LineBreakRecord.cs
- DesignerActionVerbList.cs
- XmlSchemaDocumentation.cs
- EntityDataSourceUtil.cs
- MsmqIntegrationProcessProtocolHandler.cs
- StringPropertyBuilder.cs
- DecimalStorage.cs
- FixedElement.cs
- InvalidContentTypeException.cs
- GenericTypeParameterBuilder.cs
- ExtendLockCommand.cs
- WmfPlaceableFileHeader.cs
- WindowsFormsHelpers.cs
- SystemEvents.cs
- UnsafeNativeMethods.cs
- IndexerNameAttribute.cs
- CompiledRegexRunnerFactory.cs
- FormViewPageEventArgs.cs
- TypedReference.cs
- BinaryReader.cs
- SourceFilter.cs
- RectIndependentAnimationStorage.cs
- KerberosReceiverSecurityToken.cs
- IteratorFilter.cs
- TypeSystemProvider.cs
- URLIdentityPermission.cs
- TextSpan.cs
- XmlILAnnotation.cs
- XamlFigureLengthSerializer.cs
- TextEditorDragDrop.cs
- SqlClientWrapperSmiStreamChars.cs
- DesignerView.xaml.cs
- ConnectionStringsExpressionBuilder.cs
- MouseOverProperty.cs
- XPathDocumentIterator.cs