public string Create(string content) { if (_info.IsPublic) { _script.Append("public "); } else if (_info.IsPrivate) { _script.Append("private "); } if (_prefix != null) { _script.Append(_prefix); _script.Append(' '); } _script.Append(TypeReverser.Get(_info.ReturnType)); _script.Append(' '); _script.Append(_info.Name); _script.Append("("); var parameters = _info.GetParameters(); if (parameters != null) { if (parameters.Length > 0) { _script.Append(ParameterInfoReverser.Get(parameters[0])); _script.Append(' '); _script.Append(parameters[0].Name); for (int i = 1; i < parameters.Length; i++) { _script.Append(','); _script.Append(ParameterInfoReverser.Get(parameters[i])); _script.Append(' '); _script.Append(parameters[i].Name); } } } _script.Append("){"); _script.Append(content); _script.Append("}"); return(_script.ToString()); }
public void TestOut() { var info = typeof(ReverserTestModel).GetMethod("Test2"); Assert.Equal("out Rsm<Rsm<GRsm>[]>", ParameterInfoReverser.Get(info.GetParameters()[0])); }
public void TestRef() { var info = typeof(ReverserTestModel).GetMethod("Test3"); Assert.Equal("ref Rsm<Rsm<GRsm>[]>[]", ParameterInfoReverser.Get(info.GetParameters()[0])); }
public void TestIn() { var info = typeof(ReverserTestModel).GetMethod("Test1"); Assert.Equal("in Rsm<GRsm>", ParameterInfoReverser.Get(info.GetParameters()[0])); }