• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# AccessModifier类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: Class

 public Class(AccessModifier modifier, String name)
 {
     this.Modifier = new ClassModifier(modifier);
     this.Name = name;
     this.ImplementInterfaces = new List<TypeName>();
     this.Fields = new List<Field>();
     this.Properties = new List<Property>();
     this.Constructors = new List<Constructor>();
     this.Methods = new List<Method>();
     this.Interfaces = new List<Interface>();
     this.Classes = new List<Class>();
     this.Enums = new List<Enum>();
 }
开发者ID:fengweijp,项目名称:higlabo,代码行数:13,代码来源:Class.cs


示例17: Write

        public override void Write(AccessModifier modifier)
        {
            var writer = this.TextWriter;

            switch (modifier)
            {
                case AccessModifier.Public: writer.Write("Public"); break;
                case AccessModifier.Private: writer.Write("Private"); break;
                case AccessModifier.Protected: writer.Write("Protected"); break;
                case AccessModifier.Internal: writer.Write("Internal"); break;
                case AccessModifier.ProtectedInternal: writer.Write("Protected Internal"); break;
                default: throw new NotSupportedException();
            }
        }
开发者ID:fengweijp,项目名称:higlabo,代码行数:14,代码来源:VisualBasicSourceCodeGenerator.cs


示例18: AddProperty

        public virtual void AddProperty(AccessModifier accessModifier, VirtualModifier virtualModifier,
            [NotNull] string propertyTypeName, [NotNull] string propertyName, [NotNull] IndentedStringBuilder sb)
        {
            Check.NotEmpty(propertyTypeName, nameof(propertyTypeName));
            Check.NotEmpty(propertyName, nameof(propertyName));
            Check.NotNull(sb, nameof(sb));

            AppendAccessModifier(accessModifier, sb);
            AppendVirtualModifier(virtualModifier, sb);
            sb.Append(propertyTypeName);
            sb.Append(" ");
            sb.Append(propertyName);
            sb.AppendLine(" { get; set; }");
        }
开发者ID:rbenhassine2,项目名称:EntityFramework,代码行数:14,代码来源:CSharpCodeGeneratorHelper.cs


示例19: PropertyMember

		public PropertyMember(string name, string serverType, string clientType, AccessModifier accessModifier, string backingFieldName, string backingFieldServerType, string backingFieldClientType, bool hasGetter, bool hasSetter, string valueChangedHookName, bool clientInject) {
			if (string.IsNullOrEmpty(name)) throw Utils.ArgumentException("name");
			if (string.IsNullOrEmpty(backingFieldName)) throw Utils.ArgumentException("backingFieldName");
			if (!hasGetter && !hasSetter) throw Utils.ArgumentException("Must have getter or setter.");
			if (string.IsNullOrEmpty(serverType) != string.IsNullOrEmpty(backingFieldServerType)) throw Utils.ArgumentException("serverType and backingFieldServerType must both be either null or non-null.");
			if (string.IsNullOrEmpty(clientType) != string.IsNullOrEmpty(backingFieldClientType)) throw Utils.ArgumentException("clientType and backingFieldClientType must both be either null or non-null.");
			if (valueChangedHookName != null && !ParserUtils.IsValidUnqualifiedName(valueChangedHookName)) throw Utils.ArgumentException("valueChangedHookName");
			
			this.name = name;
			this.serverType = serverType;
			this.clientType = clientType;
			this.accessModifier = accessModifier;
			this.backingFieldName = backingFieldName;
			this.backingFieldServerType = backingFieldServerType;
			this.backingFieldClientType = backingFieldClientType;
			this.hasGetter = hasGetter;
			this.hasSetter = hasSetter;
			this.valueChangedHookName = valueChangedHookName;
			this.clientInject = clientInject;
		}
开发者ID:fiinix00,项目名称:Saltarelle,代码行数:20,代码来源:PropertyMember.Shared.cs


示例20: BeginClass

        public virtual void BeginClass(AccessModifier accessModifier, [NotNull] string className,
            bool isPartial, [NotNull] IndentedStringBuilder sb, [CanBeNull] ICollection<string> inheritsFrom = null)
        {
            Check.NotEmpty(className, nameof(className));
            Check.NotNull(sb, nameof(sb));

            AppendAccessModifier(accessModifier, sb);
            if (isPartial)
            {
                sb.Append("partial ");
            }
            sb.Append("class ");
            sb.Append(className);
            if (inheritsFrom != null && inheritsFrom.Count > 0)
            {
                sb.Append(" : ");
                sb.Append(string.Join(", ", inheritsFrom));
            }
            sb.AppendLine();
            sb.AppendLine("{");
            sb.IncrementIndent();
        }
开发者ID:thegido,项目名称:EntityFramework,代码行数:22,代码来源:CSharpCodeGeneratorHelper.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# AccessRights类代码示例发布时间:2022-05-24
下一篇:
C# AccessMode类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap