本文整理汇总了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;
}
示例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());
}
示例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);
}
示例4: Field
public Field(string name, string type, bool isStatic, AccessModifier am)
{
Name = name;
Type = type;
Static = isStatic;
AccessModifier = am;
}
示例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();
}
示例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();
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}