Our new official repo is on github
LCD Smartie version 5.6 is released!
Download it now: https://github.com/LCD-Smartie/LCDSmartie/releases

C# Constructors...

Discussing issues that occur during plugin development.

Moderators: _X7JAY7X_, caesar, IFR, mattcro, limbo

Post Reply
Rafael
Plugin Author
Posts: 71
Joined: November 22nd, 2005, 7:12 pm
Location: Curitiba, Paran?, Brazil

C# Constructors...

Post by Rafael »

Hi There...

Please, in C#, what I need to myself starts the constructor in my plugin?

for example...

I need start the constructor with a parameter..

public LCDSmartie(string cod)

and so... when you call the first function, I need to send one parameter, like this:

public string function1(string param1, string param2)
{
this(param1);
// code, bla, bla..
}

Can I do this? Can I myself start a Constructor?

Thanks!

erlis
Plugin Author
Posts: 37
Joined: March 30th, 2006, 1:50 pm
Contact:

Post by erlis »

Well then you will be creating a new object of your class.

So NO, that is not possible, create a seperate method for that.

Rafael
Plugin Author
Posts: 71
Joined: November 22nd, 2005, 7:12 pm
Location: Curitiba, Paran?, Brazil

Post by Rafael »

Sure, but I need to use a parameter sended by user in constructor!

I change the constructor by private void init(string cod).

But every time that the smartie calls this DLL, Will be used a new place in memory, isn?t?

What I have now...

public LCDSmartie() {}

public string function1(string param1, string param2)
{
init(param1);
}

private void init(string cod)
{
sr = new StreamReader(file, Encoding.GetEncoding(cod));
// code...
}

:oops:

Post Reply