NClass.CSharp.CSharpMethod.InitFromString C# (CSharp) Méthode

InitFromString() public méthode

/// The does not fit to the syntax. ///
public InitFromString ( string declaration ) : void
declaration string
Résultat void
		public override void InitFromString(string declaration)
		{
			Match match = methodRegex.Match(declaration);
			RaiseChangedEvent = false;

			try {
				if (match.Success) {
					ClearModifiers();
					Group nameGroup = match.Groups["name"];
					Group typeGroup = match.Groups["type"];
					Group accessGroup = match.Groups["access"];
					Group modifierGroup = match.Groups["modifier"];
					Group staticGroup = match.Groups["static"];
					Group operatorGroup = match.Groups["operator"];
					Group convopGroup = match.Groups["convop"];
					Group nameDotGroup = match.Groups["namedot"];
					Group argsGroup = match.Groups["args"];

					if (CSharpLanguage.Instance.IsForbiddenName(nameGroup.Value))
						throw new BadSyntaxException(Strings.ErrorInvalidName);
					if (CSharpLanguage.Instance.IsForbiddenTypeName(typeGroup.Value))
						throw new BadSyntaxException(Strings.ErrorInvalidTypeName);

					ValidName = nameGroup.Value;
					ValidType = typeGroup.Value;

					isOperator = operatorGroup.Success;
					isConversionOperator = convopGroup.Success;
					if (IsOperator) {
						ClearModifiers();
						IsStatic = true;
						AccessModifier = AccessModifier.Public;
					}
					else {
						AccessModifier = Language.TryParseAccessModifier(accessGroup.Value);
					}

					IsExplicitImplementation = nameDotGroup.Success;
					ArgumentList.InitFromString(argsGroup.Value);

					foreach (Capture modifierCapture in modifierGroup.Captures) {
						if (modifierCapture.Value == "static")
							IsStatic = true;
						if (modifierCapture.Value == "virtual")
							IsVirtual = true;
						if (modifierCapture.Value == "abstract")
							IsAbstract = true;
						if (modifierCapture.Value == "override")
							IsOverride = true;
						if (modifierCapture.Value == "sealed")
							IsSealed = true;
						if (modifierCapture.Value == "new")
							IsHider = true;
					}
				}
				else {
					throw new BadSyntaxException(Strings.ErrorInvalidDeclaration);
				}
			}
			finally {
				RaiseChangedEvent = true;
			}
		}