If it's a static method then it's not associated with a particular
object instance. You should use your class name instead of using this.

Federico Raggi
Latam Developers Initiative Manager
Microsoft
 
Phone: (954)489-4862
Mobile: (954)465-4862

> -----Original Message-----
> From: Erick Thompson [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, April 25, 2002 5:13 PM
> To: [EMAIL PROTECTED]
> Subject: [DOTNET] Method call in parameter?
> 
> I have a static method with the following signature
> 
> internal static void LogError(string description, string className)
> 
> when I call it from a catch block with the following
> 
> } catch (Exception ex) {
> Util.ErrorLogging.LogError(ex.ToString(), this.GetType().Name);
> 
> I get a compile time error "Keyword this is not valid in a static
> property,
> static method, or static field initializer". I had always assumed that
> this
> was a valid way to pass in arguments. Can anyone tell me why this
> shouldn't
> work?
> 
> Thanks,
> Erick
> 
> You can read messages from the DOTNET archive, unsubscribe from
DOTNET, or
> subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to