Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / clr / src / BCL / System / Runtime / InteropServices / ErrorWrapper.cs / 1305376 / ErrorWrapper.cs
// ==++==
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// ==--==
/*==============================================================================
**
** Class: ErrorWrapper.
**
**
** Purpose: Wrapper that is converted to a variant with VT_ERROR.
**
**
=============================================================================*/
namespace System.Runtime.InteropServices {
using System;
using System.Security.Permissions;
[Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
public sealed class ErrorWrapper
{
public ErrorWrapper(int errorCode)
{
m_ErrorCode = errorCode;
}
public ErrorWrapper(Object errorCode)
{
if (!(errorCode is int))
throw new ArgumentException(Environment.GetResourceString("Arg_MustBeInt32"), "errorCode");
m_ErrorCode = (int)errorCode;
}
[System.Security.SecuritySafeCritical] // auto-generated
[SecurityPermissionAttribute(SecurityAction.Demand, Flags=SecurityPermissionFlag.UnmanagedCode)]
public ErrorWrapper(Exception e)
{
m_ErrorCode = Marshal.GetHRForException(e);
}
public int ErrorCode
{
get
{
return m_ErrorCode;
}
}
private int m_ErrorCode;
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// ==++==
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// ==--==
/*==============================================================================
**
** Class: ErrorWrapper.
**
**
** Purpose: Wrapper that is converted to a variant with VT_ERROR.
**
**
=============================================================================*/
namespace System.Runtime.InteropServices {
using System;
using System.Security.Permissions;
[Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
public sealed class ErrorWrapper
{
public ErrorWrapper(int errorCode)
{
m_ErrorCode = errorCode;
}
public ErrorWrapper(Object errorCode)
{
if (!(errorCode is int))
throw new ArgumentException(Environment.GetResourceString("Arg_MustBeInt32"), "errorCode");
m_ErrorCode = (int)errorCode;
}
[System.Security.SecuritySafeCritical] // auto-generated
[SecurityPermissionAttribute(SecurityAction.Demand, Flags=SecurityPermissionFlag.UnmanagedCode)]
public ErrorWrapper(Exception e)
{
m_ErrorCode = Marshal.GetHRForException(e);
}
public int ErrorCode
{
get
{
return m_ErrorCode;
}
}
private int m_ErrorCode;
}
}
// 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
- BaseParaClient.cs
- XmlSchemaElement.cs
- WebPart.cs
- ViewStateException.cs
- CatalogPart.cs
- InputReportEventArgs.cs
- TextRangeBase.cs
- TypedReference.cs
- DemultiplexingClientMessageFormatter.cs
- BaseDataList.cs
- COM2ExtendedUITypeEditor.cs
- EncryptedPackageFilter.cs
- StorageInfo.cs
- PropertyPathWorker.cs
- HostingPreferredMapPath.cs
- TraceSwitch.cs
- Tile.cs
- MessageQueueConverter.cs
- TextSchema.cs
- TranslateTransform.cs
- MessageDecoder.cs
- TreeViewTemplateSelector.cs
- DateTimeFormatInfoScanner.cs
- shaperfactoryquerycachekey.cs
- ToolTipAutomationPeer.cs
- LayoutEngine.cs
- AsyncCompletedEventArgs.cs
- LinqDataSourceUpdateEventArgs.cs
- SafeViewOfFileHandle.cs
- ProgressBarRenderer.cs
- TextElementAutomationPeer.cs
- ApplicationFileParser.cs
- Scanner.cs
- SwitchElementsCollection.cs
- ProviderSettingsCollection.cs
- SqlDataSourceCommandEventArgs.cs
- Faults.cs
- ContainerTracking.cs
- AddIn.cs
- Variant.cs
- GrammarBuilderBase.cs
- Membership.cs
- MetadataItemSerializer.cs
- AlternationConverter.cs
- ListBoxChrome.cs
- PropertyBuilder.cs
- Vector3DCollectionConverter.cs
- LineBreakRecord.cs
- UrlMappingsModule.cs
- AccessDataSource.cs
- WindowsButton.cs
- ImageUrlEditor.cs
- UIElement3DAutomationPeer.cs
- XmlElementAttributes.cs
- SoapMessage.cs
- CodeDOMUtility.cs
- DataGridDetailsPresenterAutomationPeer.cs
- OleDbStruct.cs
- HotSpotCollectionEditor.cs
- PaperSource.cs
- DataColumn.cs
- DescendentsWalker.cs
- IBuiltInEvidence.cs
- ArrayConverter.cs
- VectorConverter.cs
- XPathParser.cs
- QilInvokeLateBound.cs
- DockPattern.cs
- brushes.cs
- TerminatorSinks.cs
- ScrollBarAutomationPeer.cs
- RowBinding.cs
- Symbol.cs
- SettingsPropertyIsReadOnlyException.cs
- EnumValidator.cs
- ReadContentAsBinaryHelper.cs
- StreamInfo.cs
- XomlCompiler.cs
- AddInEnvironment.cs
- XmlAttributeProperties.cs
- Hashtable.cs
- ProviderSettingsCollection.cs
- FileDialogPermission.cs
- CryptoKeySecurity.cs
- EqualityArray.cs
- ConfigXmlCDataSection.cs
- ProjectionRewriter.cs
- PTProvider.cs
- DBCSCodePageEncoding.cs
- SecurityHelper.cs
- RecordsAffectedEventArgs.cs
- ScriptComponentDescriptor.cs
- ListSortDescription.cs
- KeyedHashAlgorithm.cs
- IisTraceWebEventProvider.cs
- TraceEventCache.cs
- NonSerializedAttribute.cs
- RequiredFieldValidator.cs
- QuotaThrottle.cs
- SessionSwitchEventArgs.cs