Code:
/ 4.0 / 4.0 / 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. //------------------------------------------------------------------------------ // 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
- DocumentOrderQuery.cs
- XpsInterleavingPolicy.cs
- AsyncCompletedEventArgs.cs
- CheckStoreFileValidityRequest.cs
- FunctionNode.cs
- PortCache.cs
- CodeSubDirectoriesCollection.cs
- ScriptingWebServicesSectionGroup.cs
- TagPrefixCollection.cs
- ToolStripContainer.cs
- HttpHandlersSection.cs
- TreeViewItemAutomationPeer.cs
- XmlFormatWriterGenerator.cs
- ZipIOLocalFileHeader.cs
- HttpContextServiceHost.cs
- OlePropertyStructs.cs
- UIHelper.cs
- EditorPartCollection.cs
- xdrvalidator.cs
- InvalidProgramException.cs
- ReaderOutput.cs
- FullTextBreakpoint.cs
- PerformanceCountersElement.cs
- PropertyRef.cs
- TemplateKeyConverter.cs
- HtmlElement.cs
- DataGridViewAutoSizeModeEventArgs.cs
- ByteRangeDownloader.cs
- ViewManagerAttribute.cs
- ReflectionUtil.cs
- XPathDescendantIterator.cs
- TextServicesCompartment.cs
- DataObject.cs
- ComplexType.cs
- TextTreeInsertElementUndoUnit.cs
- Roles.cs
- FreeFormDesigner.cs
- DesignTimeXamlWriter.cs
- BaseTemplateCodeDomTreeGenerator.cs
- Int16Converter.cs
- FixedSOMImage.cs
- LinqDataSourceStatusEventArgs.cs
- typedescriptorpermission.cs
- WebPart.cs
- OutputCacheProfileCollection.cs
- Annotation.cs
- ConcurrentBag.cs
- AssemblyBuilderData.cs
- SqlConnectionPoolProviderInfo.cs
- PermissionSetTriple.cs
- MDIControlStrip.cs
- ArgIterator.cs
- FileDialog.cs
- Boolean.cs
- HandlerFactoryCache.cs
- SqlParameter.cs
- DataColumnSelectionConverter.cs
- AsymmetricKeyExchangeFormatter.cs
- SrgsElementList.cs
- precedingsibling.cs
- mongolianshape.cs
- OleTxTransaction.cs
- CounterNameConverter.cs
- SafeRightsManagementSessionHandle.cs
- WebReferencesBuildProvider.cs
- SpecialNameAttribute.cs
- FontFamily.cs
- TypeConverterHelper.cs
- COAUTHINFO.cs
- ReaderWriterLockWrapper.cs
- StylusPointProperties.cs
- SoapFormatterSinks.cs
- DataGridViewRowCancelEventArgs.cs
- WebControlAdapter.cs
- Int16.cs
- ButtonColumn.cs
- XmlWellformedWriter.cs
- SectionInput.cs
- OperationDescription.cs
- DataSourceControl.cs
- MimeTypeMapper.cs
- RectangleGeometry.cs
- HMACSHA1.cs
- ListControlConvertEventArgs.cs
- DataGridViewRowDividerDoubleClickEventArgs.cs
- JapaneseLunisolarCalendar.cs
- TrailingSpaceComparer.cs
- TextProperties.cs
- ClientProxyGenerator.cs
- Dictionary.cs
- FreeFormDesigner.cs
- PolyQuadraticBezierSegmentFigureLogic.cs
- _ConnectStream.cs
- CodeObjectCreateExpression.cs
- lengthconverter.cs
- CombinedHttpChannel.cs
- UndirectedGraph.cs
- ParsedAttributeCollection.cs
- UpdatePanelControlTrigger.cs
- HwndKeyboardInputProvider.cs