Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / ndp / fx / src / CompMod / System / CodeDOM / CodeTypeDeclaration.cs / 1 / CodeTypeDeclaration.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.CodeDom {
using System.Diagnostics;
using System;
using Microsoft.Win32;
using System.Collections;
using System.Reflection;
using System.Runtime.Serialization;
using System.Runtime.InteropServices;
///
///
/// Represents a
/// class or nested class.
///
///
[
ClassInterface(ClassInterfaceType.AutoDispatch),
ComVisible(true),
Serializable,
]
public class CodeTypeDeclaration : CodeTypeMember {
private TypeAttributes attributes = Reflection.TypeAttributes.Public | Reflection.TypeAttributes.Class;
private CodeTypeReferenceCollection baseTypes = new CodeTypeReferenceCollection();
private CodeTypeMemberCollection members = new CodeTypeMemberCollection();
private bool isEnum;
private bool isStruct;
private int populated = 0x0;
private const int BaseTypesCollection = 0x1;
private const int MembersCollection = 0x2;
// Need to be made optionally serializable
[OptionalField]
private CodeTypeParameterCollection typeParameters;
[OptionalField]
private bool isPartial = false;
///
///
/// An event that will be fired the first time the BaseTypes Collection is accessed.
///
///
public event EventHandler PopulateBaseTypes;
///
///
/// An event that will be fired the first time the Members Collection is accessed.
///
///
public event EventHandler PopulateMembers;
///
///
/// Initializes a new instance of .
///
///
public CodeTypeDeclaration() {
}
///
///
/// Initializes a new instance of with the specified name.
///
///
public CodeTypeDeclaration(string name) {
Name = name;
}
///
///
/// Gets or sets the attributes of the class.
///
///
public TypeAttributes TypeAttributes {
get {
return attributes;
}
set {
attributes = value;
}
}
///
///
/// Gets or sets
/// the base types of the class.
///
///
public CodeTypeReferenceCollection BaseTypes {
get {
if (0 == (populated & BaseTypesCollection)) {
populated |= BaseTypesCollection;
if (PopulateBaseTypes != null) PopulateBaseTypes(this, EventArgs.Empty);
}
return baseTypes;
}
}
///
///
/// Gets or sets a value
/// indicating whether the class is a class.
///
///
public bool IsClass {
get {
return(attributes & TypeAttributes.ClassSemanticsMask) == TypeAttributes.Class && !isEnum && !isStruct;
}
set {
if (value) {
attributes &= ~TypeAttributes.ClassSemanticsMask;
attributes |= TypeAttributes.Class;
isStruct = false;
isEnum = false;
}
}
}
///
///
/// Gets or sets a value
/// indicating whether the class is a struct.
///
///
public bool IsStruct {
get {
return isStruct;
}
set {
if (value) {
attributes &= ~TypeAttributes.ClassSemanticsMask;
isStruct = true;
isEnum = false;
}
else {
isStruct = false;
}
}
}
///
///
/// Gets or sets a value
/// indicating whether the class is an enumeration.
///
///
public bool IsEnum {
get {
return isEnum;
}
set {
if (value) {
attributes &= ~TypeAttributes.ClassSemanticsMask;
isStruct = false;
isEnum = true;
}
else {
isEnum = false;
}
}
}
///
///
/// Gets or sets a value
/// indicating whether the class is an interface.
///
///
public bool IsInterface {
get {
return(attributes & TypeAttributes.ClassSemanticsMask) == TypeAttributes.Interface;
}
set {
if (value) {
attributes &= ~TypeAttributes.ClassSemanticsMask;
attributes |= TypeAttributes.Interface;
isStruct = false;
isEnum = false;
}
else {
attributes &= ~TypeAttributes.Interface;
}
}
}
public bool IsPartial {
get {
return isPartial;
}
set {
isPartial = value;
}
}
///
///
/// Gets or sets the class member collection members.
///
///
public CodeTypeMemberCollection Members {
get {
if (0 == (populated & MembersCollection)) {
populated |= MembersCollection;
if (PopulateMembers != null) PopulateMembers(this, EventArgs.Empty);
}
return members;
}
}
[System.Runtime.InteropServices.ComVisible(false)]
public CodeTypeParameterCollection TypeParameters {
get {
if( typeParameters == null) {
typeParameters = new CodeTypeParameterCollection();
}
return typeParameters;
}
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.CodeDom {
using System.Diagnostics;
using System;
using Microsoft.Win32;
using System.Collections;
using System.Reflection;
using System.Runtime.Serialization;
using System.Runtime.InteropServices;
///
///
/// Represents a
/// class or nested class.
///
///
[
ClassInterface(ClassInterfaceType.AutoDispatch),
ComVisible(true),
Serializable,
]
public class CodeTypeDeclaration : CodeTypeMember {
private TypeAttributes attributes = Reflection.TypeAttributes.Public | Reflection.TypeAttributes.Class;
private CodeTypeReferenceCollection baseTypes = new CodeTypeReferenceCollection();
private CodeTypeMemberCollection members = new CodeTypeMemberCollection();
private bool isEnum;
private bool isStruct;
private int populated = 0x0;
private const int BaseTypesCollection = 0x1;
private const int MembersCollection = 0x2;
// Need to be made optionally serializable
[OptionalField]
private CodeTypeParameterCollection typeParameters;
[OptionalField]
private bool isPartial = false;
///
///
/// An event that will be fired the first time the BaseTypes Collection is accessed.
///
///
public event EventHandler PopulateBaseTypes;
///
///
/// An event that will be fired the first time the Members Collection is accessed.
///
///
public event EventHandler PopulateMembers;
///
///
/// Initializes a new instance of .
///
///
public CodeTypeDeclaration() {
}
///
///
/// Initializes a new instance of with the specified name.
///
///
public CodeTypeDeclaration(string name) {
Name = name;
}
///
///
/// Gets or sets the attributes of the class.
///
///
public TypeAttributes TypeAttributes {
get {
return attributes;
}
set {
attributes = value;
}
}
///
///
/// Gets or sets
/// the base types of the class.
///
///
public CodeTypeReferenceCollection BaseTypes {
get {
if (0 == (populated & BaseTypesCollection)) {
populated |= BaseTypesCollection;
if (PopulateBaseTypes != null) PopulateBaseTypes(this, EventArgs.Empty);
}
return baseTypes;
}
}
///
///
/// Gets or sets a value
/// indicating whether the class is a class.
///
///
public bool IsClass {
get {
return(attributes & TypeAttributes.ClassSemanticsMask) == TypeAttributes.Class && !isEnum && !isStruct;
}
set {
if (value) {
attributes &= ~TypeAttributes.ClassSemanticsMask;
attributes |= TypeAttributes.Class;
isStruct = false;
isEnum = false;
}
}
}
///
///
/// Gets or sets a value
/// indicating whether the class is a struct.
///
///
public bool IsStruct {
get {
return isStruct;
}
set {
if (value) {
attributes &= ~TypeAttributes.ClassSemanticsMask;
isStruct = true;
isEnum = false;
}
else {
isStruct = false;
}
}
}
///
///
/// Gets or sets a value
/// indicating whether the class is an enumeration.
///
///
public bool IsEnum {
get {
return isEnum;
}
set {
if (value) {
attributes &= ~TypeAttributes.ClassSemanticsMask;
isStruct = false;
isEnum = true;
}
else {
isEnum = false;
}
}
}
///
///
/// Gets or sets a value
/// indicating whether the class is an interface.
///
///
public bool IsInterface {
get {
return(attributes & TypeAttributes.ClassSemanticsMask) == TypeAttributes.Interface;
}
set {
if (value) {
attributes &= ~TypeAttributes.ClassSemanticsMask;
attributes |= TypeAttributes.Interface;
isStruct = false;
isEnum = false;
}
else {
attributes &= ~TypeAttributes.Interface;
}
}
}
public bool IsPartial {
get {
return isPartial;
}
set {
isPartial = value;
}
}
///
///
/// Gets or sets the class member collection members.
///
///
public CodeTypeMemberCollection Members {
get {
if (0 == (populated & MembersCollection)) {
populated |= MembersCollection;
if (PopulateMembers != null) PopulateMembers(this, EventArgs.Empty);
}
return members;
}
}
[System.Runtime.InteropServices.ComVisible(false)]
public CodeTypeParameterCollection TypeParameters {
get {
if( typeParameters == null) {
typeParameters = new CodeTypeParameterCollection();
}
return typeParameters;
}
}
}
}
// 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
- SessionState.cs
- X509SecurityTokenProvider.cs
- OverflowException.cs
- ListenerChannelContext.cs
- Simplifier.cs
- CodeVariableDeclarationStatement.cs
- ProfileSection.cs
- CryptoApi.cs
- SoapDocumentServiceAttribute.cs
- Environment.cs
- RichTextBoxConstants.cs
- FamilyCollection.cs
- ResourcePermissionBase.cs
- DesignerOptionService.cs
- OpenTypeCommon.cs
- GridViewEditEventArgs.cs
- BindingList.cs
- XmlSerializerVersionAttribute.cs
- SafeFileMapViewHandle.cs
- ObjectDataSourceMethodEventArgs.cs
- QueryCacheEntry.cs
- TextSimpleMarkerProperties.cs
- FilteredAttributeCollection.cs
- pingexception.cs
- DataGridViewSortCompareEventArgs.cs
- HandlerBase.cs
- ProcessManager.cs
- TypedCompletedAsyncResult.cs
- NativeWindow.cs
- Blend.cs
- PostBackOptions.cs
- XamlLoadErrorInfo.cs
- ServiceRoute.cs
- MbpInfo.cs
- CookieProtection.cs
- SHA384Managed.cs
- HyperLink.cs
- ValidationUtility.cs
- TraceSection.cs
- recordstatefactory.cs
- TypeUtils.cs
- DropDownList.cs
- IxmlLineInfo.cs
- EventTask.cs
- DataGridViewLinkCell.cs
- WebServicesInteroperability.cs
- HideDisabledControlAdapter.cs
- PrivacyNoticeElement.cs
- Transactions.cs
- InvalidAsynchronousStateException.cs
- ChannelTraceRecord.cs
- ClientTargetCollection.cs
- ReflectionHelper.cs
- VisualStateManager.cs
- PipeStream.cs
- ProtocolsSection.cs
- Hex.cs
- DbDataAdapter.cs
- WmlObjectListAdapter.cs
- Compensate.cs
- DrawingImage.cs
- DataViewManager.cs
- LinkLabel.cs
- BindingNavigator.cs
- XmlBaseWriter.cs
- coordinator.cs
- TranslateTransform3D.cs
- Script.cs
- EnvelopedPkcs7.cs
- SQLBinaryStorage.cs
- TemplateLookupAction.cs
- SqlNamer.cs
- Pair.cs
- PrintPageEvent.cs
- TableSectionStyle.cs
- BaseDataList.cs
- XmlSchemaType.cs
- AuthenticationServiceManager.cs
- Rectangle.cs
- SystemIPAddressInformation.cs
- SqlRowUpdatedEvent.cs
- CodeAttachEventStatement.cs
- ObjectDataSourceFilteringEventArgs.cs
- TextPattern.cs
- ExitEventArgs.cs
- PinProtectionHelper.cs
- SafeLocalMemHandle.cs
- HasCopySemanticsAttribute.cs
- adornercollection.cs
- WorkflowFileItem.cs
- UnicastIPAddressInformationCollection.cs
- MetafileHeaderWmf.cs
- FormsAuthenticationCredentials.cs
- StreamReader.cs
- RegionInfo.cs
- SoapRpcServiceAttribute.cs
- DocumentSchemaValidator.cs
- DictionaryGlobals.cs
- ModelPropertyDescriptor.cs
- ExceptionHelpers.cs