当前位置: 首页>>代码示例>>C#>>正文


C# AccessModifier类代码示例

本文整理汇总了C#中AccessModifier的典型用法代码示例。如果您正苦于以下问题:C# AccessModifier类的具体用法?C# AccessModifier怎么用?C# AccessModifier使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


AccessModifier类属于命名空间,在下文中一共展示了AccessModifier类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ClassModifier

 public ClassModifier(AccessModifier accessModifier)
 {
     this.AccessModifier = accessModifier;
     this.Static = false;
     this.Abstract = false;
     this.Partial = false;
 }
开发者ID:fengweijp,项目名称:higlabo,代码行数:7,代码来源:ClassModifier.cs

示例2: GetModifier

 public static string GetModifier(AccessModifier? access, MemberModifier? modifier)
 {
     if (modifier == null)
         return access.ToString().ToLower();
     else
         return string.Format("{0} {1}", access.ToString().ToLower(), modifier.ToString().ToLower());
 }
开发者ID:cmcginn,项目名称:AIM,代码行数:7,代码来源:Naming.cs

示例3: GetField

 /// <summary>
 /// Get field value.
 /// </summary>
 /// <param name="access">Specify field access modifier.</param>
 /// <param name="obj">Object where field is defined.</param>
 /// <param name="fieldName">Field name.</param>
 /// <param name="lookInBase">Specify if need to look in Base classes.</param>
 /// <returns>Field value</returns>
 public static object GetField(AccessModifier access, object obj, string fieldName, bool lookInBase)
 {
     CheckObject(obj);
     FieldInfo fi = GetField(access, obj.GetType(), fieldName, lookInBase);
     IsMember(obj, fi, fieldName, MemberType.Field);
     return fi.GetValue(obj);
 }
开发者ID:timonela,项目名称:mb-unit,代码行数:15,代码来源:ReflectorStatic.cs

示例4: Field

 public Field(string name, string type, bool isStatic, AccessModifier am)
 {
     Name = name;
     Type = type;
     Static = isStatic;
     AccessModifier = am;
 }
开发者ID:ignacio1029,项目名称:blueprint,代码行数:7,代码来源:Field.cs

示例5: FunctionDeclarationHeader

 public FunctionDeclarationHeader(SymbolDefinition name, AccessModifier visibility, FunctionType type)
     : base(CodeElementType.FunctionDeclarationHeader)
 {
     this.FunctionName = name;
     this.Visibility = visibility;
     this.UserDefinedType = type != null ? type : FunctionType.Undefined;
     this.Profile = new ParametersProfile();
 }
开发者ID:osmedile,项目名称:TypeCobol,代码行数:8,代码来源:FunctionDeclarationHeader.cs

示例6: Constructor

 public Constructor(AccessModifier accessModifier, String name)
 {
     this.Modifier = new ConstructorModifier(accessModifier);
     this.Name = name;
     this.Parameters = new List<MethodParameter>();
     this.GenericParameters = new List<String>();
     this.Body = new CodeBlockCollection();
 }
开发者ID:fengweijp,项目名称:higlabo,代码行数:8,代码来源:Constructor.cs

示例7: Constructor

 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="AccessModifier">Access modifier</param>
 /// <param name="ClassName">Class name</param>
 /// <param name="ParameterList">Parameter list</param>
 /// <param name="Body">Body of the constructor</param>
 /// <param name="Parser">Parser to use</param>
 public Constructor(AccessModifier AccessModifier, string ClassName, IParameter[] ParameterList, string Body, IParser Parser)
     : base(Parser)
 {
     this.AccessModifier = AccessModifier;
     this.ClassName = ClassName;
     this.Parameters = ParameterList.ToList();
     this.Body = Body;
 }
开发者ID:gwilkinson,项目名称:Craig-s-Utility-Library,代码行数:16,代码来源:Constructor.cs

示例8: Method

 public Method(string name, string retType, bool isStatic, AccessModifier am, params string[] paramTypes)
 {
     Name = name;
     ReturnType = retType;
     Static = isStatic;
     AccessModifier = am;
     ParameterTypes = paramTypes;
 }
开发者ID:ignacio1029,项目名称:blueprint,代码行数:8,代码来源:Method.cs

示例9: Visit

        /// <summary>
        /// Visits the syntax node.
        /// </summary>
        /// <param name="parentNode">Node</param>
        /// <param name="isStart">Is start state</param>
        /// <param name="accMod">Access modifier</param>
        internal void Visit(MachineDeclaration parentNode, bool isStart, AccessModifier accMod)
        {
            var node = new StateDeclaration(base.TokenStream.Program, parentNode,
                isStart, parentNode.IsModel);
            node.AccessModifier = accMod;
            node.StateKeyword = base.TokenStream.Peek();

            base.TokenStream.Index++;
            base.TokenStream.SkipWhiteSpaceAndCommentTokens();

            if (base.TokenStream.Done ||
                base.TokenStream.Peek().Type != TokenType.Identifier)
            {
                throw new ParsingException("Expected state identifier.",
                    new List<TokenType>
                {
                    TokenType.Identifier
                });
            }

            base.TokenStream.CurrentState = base.TokenStream.Peek().Text;
            base.TokenStream.Swap(new Token(base.TokenStream.Peek().TextUnit,
                TokenType.StateIdentifier));

            node.Identifier = base.TokenStream.Peek();

            base.TokenStream.Index++;
            base.TokenStream.SkipWhiteSpaceAndCommentTokens();

            if (base.TokenStream.Done ||
                base.TokenStream.Peek().Type != TokenType.LeftCurlyBracket)
            {
                throw new ParsingException("Expected \"{\".",
                    new List<TokenType>
                {
                    TokenType.LeftCurlyBracket
                });
            }

            base.TokenStream.Swap(new Token(base.TokenStream.Peek().TextUnit,
                TokenType.StateLeftCurlyBracket));

            node.LeftCurlyBracketToken = base.TokenStream.Peek();

            base.TokenStream.Index++;
            base.TokenStream.SkipWhiteSpaceAndCommentTokens();

            if (base.TokenStream.Program is PSharpProgram)
            {
                this.VisitNextPSharpIntraStateDeclaration(node);
            }
            else
            {
                this.VisitNextPIntraStateDeclaration(node);
            }

            parentNode.StateDeclarations.Add(node);
        }
开发者ID:jerickmsft,项目名称:PSharp,代码行数:64,代码来源:StateDeclarationVisitor.cs

示例10: Visit

        /// <summary>
        /// Visits the syntax node.
        /// </summary>
        /// <param name="parentNode">Node</param>
        /// <param name="typeIdentifier">Type identifier</param>
        /// <param name="identifier">Identifier</param>
        /// <param name="accMod">Access modifier</param>
        /// <param name="inhMod">Inheritance modifier</param>
        /// <param name="isAsync">Is async</param>
        /// <param name="isPartial">Is partial</param>
        internal void Visit(MachineDeclaration parentNode, Token typeIdentifier, Token identifier,
            AccessModifier accMod, InheritanceModifier inhMod, bool isAsync, bool isPartial)
        {
            var node = new MethodDeclaration(base.TokenStream.Program, parentNode);
            node.AccessModifier = accMod;
            node.InheritanceModifier = inhMod;
            node.TypeIdentifier = typeIdentifier;
            node.Identifier = identifier;
            node.IsAsync = isAsync;
            node.IsPartial = isPartial;

            node.LeftParenthesisToken = base.TokenStream.Peek();

            base.TokenStream.Index++;
            base.TokenStream.SkipWhiteSpaceAndCommentTokens();

            while (!base.TokenStream.Done &&
                base.TokenStream.Peek().Type != TokenType.RightParenthesis)
            {
                base.TokenStream.Swap(new Token(base.TokenStream.Peek().TextUnit));

                node.Parameters.Add(base.TokenStream.Peek());

                base.TokenStream.Index++;
                base.TokenStream.SkipWhiteSpaceAndCommentTokens();
            }

            node.RightParenthesisToken = base.TokenStream.Peek();

            base.TokenStream.Index++;
            base.TokenStream.SkipWhiteSpaceAndCommentTokens();

            if (base.TokenStream.Done ||
                (base.TokenStream.Peek().Type != TokenType.LeftCurlyBracket &&
                base.TokenStream.Peek().Type != TokenType.Semicolon))
            {
                throw new ParsingException("Expected \"{\" or \";\".",
                    new List<TokenType>
                {
                    TokenType.LeftCurlyBracket,
                    TokenType.Semicolon
                });
            }

            if (base.TokenStream.Peek().Type == TokenType.LeftCurlyBracket)
            {
                var blockNode = new BlockSyntax(base.TokenStream.Program, parentNode, null);
                new BlockSyntaxVisitor(base.TokenStream).Visit(blockNode);
                node.StatementBlock = blockNode;
            }
            else if (base.TokenStream.Peek().Type == TokenType.Semicolon)
            {
                node.SemicolonToken = base.TokenStream.Peek();
            }

            parentNode.MethodDeclarations.Add(node);
        }
开发者ID:yonglehou,项目名称:PSharp,代码行数:67,代码来源:MethodDeclarationVisitor.cs

示例11: GetStandardValues

 public override System.ComponentModel.TypeConverter.StandardValuesCollection GetStandardValues(System.ComponentModel.ITypeDescriptorContext context)
 {
     AccessModifier[] accessModifierArr = new AccessModifier[5];
     accessModifierArr[1] = AccessModifier.Assembly;
     accessModifierArr[2] = AccessModifier.Private;
     accessModifierArr[3] = AccessModifier.Family;
     accessModifierArr[4] = AccessModifier.FamilyOrAssembly;
     return new System.ComponentModel.TypeConverter.StandardValuesCollection(accessModifierArr);
 }
开发者ID:apoorv-vijay-joshi,项目名称:FSE-2011-PDE,代码行数:9,代码来源:AccessModifierConverter.cs

示例12: Function

 /// <summary>Creates functions or procedure</summary>
 public Function(QualifiedName name, IList<ParameterDescription> inputs, IList<ParameterDescription> outputs, IList<ParameterDescription> inouts, ParameterDescription returning, AccessModifier visibility = AccessModifier.Private)
 {
     QualifiedName = name;
     Profile = new ParametersProfile();
     Profile.InputParameters  = inputs  ?? new List<ParameterDescription>();
     Profile.OutputParameters = outputs ?? new List<ParameterDescription>();
     Profile.InoutParameters  = inouts  ?? new List<ParameterDescription>();
     Profile.ReturningParameter = returning;
     Visibility = visibility;
 }
开发者ID:laurentprudhon,项目名称:TypeCobol,代码行数:11,代码来源:Function.cs

示例13: Function

 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="AccessModifier">Access modifier</param>
 /// <param name="Modifier">Modifier</param>
 /// <param name="Type">Type</param>
 /// <param name="FunctionName">Function name</param>
 /// <param name="ParameterList">Parameter list</param>
 /// <param name="Body">Body of the function</param>
 /// <param name="Parser">Parser to use</param>
 public Function(AccessModifier AccessModifier, Modifiers Modifier, string Type,
     string FunctionName, IParameter[] ParameterList, string Body, IParser Parser)
     : base(Parser)
 {
     this.AccessModifier = AccessModifier;
     this.Modifier = Modifier;
     this.Type = Type;
     this.Name = FunctionName;
     this.Parameters = ParameterList.ToList();
     this.Body = Body;
 }
开发者ID:gwilkinson,项目名称:Craig-s-Utility-Library,代码行数:21,代码来源:Function.cs

示例14: Class

 public Class(AccessModifier AccessModifier, Modifiers Modifier, string ClassName,
     string Namespace)
     : base()
 {
     Properties = new List<IProperty>();
     Usings = new List<Using>();
     Constructors = new List<IFunction>();
     Functions = new List<IFunction>();
     this.ClassName = ClassName;
     this.AccessModifier = AccessModifier;
     this.Modifier = Modifier;
     this.Namespace = Namespace;
 }
开发者ID:JKLFA,项目名称:Craig-s-Utility-Library,代码行数:13,代码来源:Class.cs

示例15: WriteDeclarator

		public static string WriteDeclarator(AccessModifier am, string type, string name) {
			string s;
			switch (am) {
				case AccessModifier._Public:            s = "public "; break;
				case AccessModifier._Protected:         s = "protected "; break;
				case AccessModifier._Private:           s = "private "; break;
				case AccessModifier._Internal:          s = "internal "; break;
				case AccessModifier._ProtectedInternal: s = "protected internal "; break;
				case AccessModifier._None:              s = ""; break;
				default: throw Utils.ArgumentException("am");
			}
			return s + type + " " + name;
		}
开发者ID:fiinix00,项目名称:Saltarelle,代码行数:13,代码来源:IMember.Shared.cs


注:本文中的AccessModifier类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。