本文整理汇总了C#中Mono.CSharp.TypeContainer.AddEvent方法的典型用法代码示例。如果您正苦于以下问题:C# TypeContainer.AddEvent方法的具体用法?C# TypeContainer.AddEvent怎么用?C# TypeContainer.AddEvent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mono.CSharp.TypeContainer
的用法示例。
在下文中一共展示了TypeContainer.AddEvent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: yyparse
//.........这里部分代码省略.........
Report.Error (575, lt.Location, "Only class types can contain destructor");
} else {
Destructor d = new Destructor (current_class, (Modifiers) yyVals[-6+yyTop],
ParametersCompiled.EmptyReadOnlyParameters, (Attributes) yyVals[-7+yyTop], lt.Location);
if (RootContext.Documentation != null)
d.DocComment = ConsumeStoredComment ();
d.Block = (ToplevelBlock) yyVals[0+yyTop];
current_container.AddMethod (d);
}
current_local_parameters = null;
}
break;
case 291:
#line 2248 "cs-parser.jay"
{
foreach (VariableMemberDeclaration var in (List<object>) yyVals[-1+yyTop]) {
EventField e = new EventField (
current_class, (FullNamedExpression) yyVals[-2+yyTop], (Modifiers) yyVals[-4+yyTop], var.MemberName, (Attributes) yyVals[-5+yyTop]);
e.Initializer = var.GetInitializer ((FullNamedExpression) yyVals[-2+yyTop]);
if (current_container.Kind == MemberKind.Interface && e.Initializer != null) {
Report.Error (68, e.Location, "`{0}': event in interface cannot have initializer", e.GetSignatureForError ());
}
if (var.MemberName.Left != null) {
Report.Error (71, e.Location,
"`{0}': An explicit interface implementation of an event must use property syntax",
e.GetSignatureForError ());
}
current_container.AddEvent (e);
if (RootContext.Documentation != null) {
e.DocComment = Lexer.consume_doc_comment ();
Lexer.doc_state = XmlCommentState.Allowed;
}
}
}
break;
case 292:
#line 2277 "cs-parser.jay"
{
implicit_value_parameter_type = (FullNamedExpression) yyVals[-2+yyTop];
current_local_parameters = new ParametersCompiled (compiler,
new Parameter (implicit_value_parameter_type, "value",
Parameter.Modifier.NONE, null, GetLocation (yyVals[-3+yyTop])));
lexer.EventParsing = true;
}
break;
case 293:
#line 2286 "cs-parser.jay"
{
lexer.EventParsing = false;
}
break;
case 294:
#line 2290 "cs-parser.jay"
{
MemberName name = (MemberName) yyVals[-5+yyTop];
if (current_container.Kind == MemberKind.Interface) {
Report.Error (69, GetLocation (yyVals[-7+yyTop]), "Event in interface cannot have add or remove accessors");