Search This Blog

Friday, August 12, 2011

Keyword 'this' is not valid in a static property, static method, or static field initialize.

'this' object is not a static property, static method, or static field initialize , so it can not be used to call a static method.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ArnoldBaseModule
{
public class Message
{
public static string GetMessage(int ModuleId, int UserId, int AppId, int ConAppId, bool Successed, int indicator)
{
if (Successed)
{
this.GenerateMessage(ModuleId, UserId, AppId, ConAppId, Successed, indicator);
//Use below line without 'this' to call a methos instead of above............
GenerateMessage(ModuleId, UserId, AppId, ConAppId, Successed, indicator);
}
return "";
}
private static string GenerateMessage(int ModuleId, int UserId, int AppId, int ConAppId, bool Successed, int indicator)
{
return "";
}
}
}

No comments:

Post a Comment