|
are you wanting to output to the console?
"If your actions inspire others to dream more, learn more, do more and become more, you are a leader." - John Quincy Adams
|
|
|
|
|
KARFER wrote: I want to say how to create a print function without using Console.write() and name it as you like.
In what language would you want that, C, C# or C++?
KARFER wrote: I hear that i can do it by overloading or overriding or anything else .. i don't know.
Well, you can create methods and name 'em however you want, and they can do whatever you want. Problem is often describing what one wants. Try giving a more detailed example on what you're trying to accomplish
I are Troll
|
|
|
|
|
Eddy Vluggen wrote: In what language would you want that, C, C# or C++?
I feel obliged to draw your attention to the Forum name, Eddy...
I wasn't, now I am, then I won't be anymore.
|
|
|
|
|
Marcus Kramer wrote: I feel obliged to draw your attention to the Forum name, Eddy
This isn't my forum, it's the C# forum
He's cross-posting, making me wonder what kind of textbook he's reading to come up with a question like this
|
|
|
|
|
We can only wish he would start studying a book rather than ask random questions.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Eddy Vluggen wrote: In what language would you want that, C, C# or C++?
You forgot Visual Basic and PHP.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
I wouldn't let CG touch my Abacus!
When you're wrestling a gorilla, you don't stop when you're tired, you stop when the gorilla is.
|
|
|
|
|
Henry Minute wrote: You forgot Visual Basic and PHP
Why, did he also crosspost in the interpreter-fora?
I are Troll
|
|
|
|
|
|
I have x86 and x64 builds of the class library. It is not possible to have Any CPU build since it depends on unsafe builds of the native dll which is also in x86 and x64 builds.
How can I add those 2 to the application project references?
The references is global for any configuration.
The same question is related to debug and release builds.
The other bug even I added x86 file to references x64 is always copied with application exe.
There are no such problems if you add class library project to solution with application though
Чесноков
|
|
|
|
|
You can't add them both. What you could do, is deploy them separately through a custom installation event as the only time it should make a difference is when the application is installed.
|
|
|
|
|
What Pete said. So long as they both have the same interface, you may also want to look into IoC
Architecture is extensible, code is minimal.
|
|
|
|
|
No, I've found a solution to correct .csproj file manually
<Reference Include="MyLibrary, Version=1.0.0.0, Culture=neutral, processorArchitecture=AMD64">
<SpecificVersion>False</SpecificVersion>
<HintPath>libs\$(Platform)\MyLibrary.dll</HintPath>
</Reference>
Чесноков
|
|
|
|
|
The real problem isn't clear.
Some some other possibilities that might be related to the real problem(s).
- Load the library dynamically.
- Create a build event which copies the library based on the type of build requested.
|
|
|
|
|
I it possible to make an abstract delegate ?
I have abstract class A
and classes B & C. Each of them rise some event. i want to declare an abstract event and to implement is differently in B/C classes.
Thanks
|
|
|
|
|
The delegate has no implementation so it is already an abstraction. The handler methods can be abstract though...
public abstract class AbstractBase
{
public event EventHandler DoXxx;
protected abstract void OnDoXxx(EventArgs e);
}
public class Concrete1 : AbstractBase
{
protected override void OnDoXxx(EventArgs e)
{
}
}
public class Concrete2 : AbstractBase
{
protected override void OnDoXxx(EventArgs e)
{
}
}
|
|
|
|
|
thanks for the answer...
and if i want to do it next way :
{
public delegate void delgateX(object sender, EventArgs e);
abstarct class A:
{
public event delgateX xxx;
}
}
class B : A
{
}
class C : A
{
}
i get next error :
The event 'xxx' can only appear on the left hand side of += or -= (except when used from within the type 'A')
Thanks for help
|
|
|
|
|
Ah, I see your problem.
The delegate itself can't be abstract but an instance of it (including an event) can. See the sample and test code below.
using System;
class Program
{
static void Main(string[] args)
{
new Test().Run();
Console.ReadKey();
}
}
class Test
{
public void Run()
{
B b = new B();
b.Xxx += new DelegateXxx(b_Xxx);
C c = new C();
c.Xxx += new DelegateXxx(c_Xxx);
A ab = b as A;
ab.Xxx += new DelegateXxx(ab_Xxx);
A ac = c as A;
ac.Xxx += new DelegateXxx(ac_Xxx);
b.DoXxx();
Console.WriteLine();
ab.DoXxx();
Console.WriteLine();
c.DoXxx();
Console.WriteLine();
ac.DoXxx();
Console.WriteLine();
}
private void b_Xxx(object sender, EventArgs e)
{
Console.WriteLine("b_Xxx Raised");
}
private void c_Xxx(object sender, EventArgs e)
{
Console.WriteLine("c_Xxx Raised");
}
private void ab_Xxx(object sender, EventArgs e)
{
Console.WriteLine("ab_Xxx Raised");
}
private void ac_Xxx(object sender, EventArgs e)
{
Console.WriteLine("ac_Xxx Raised");
}
}
public delegate void DelegateXxx(object sender, EventArgs e);
public abstract class A
{
public abstract event DelegateXxx Xxx;
public abstract void DoXxx();
protected abstract void OnXxx(EventArgs e);
}
public class B : A
{
public override event DelegateXxx Xxx;
public override void DoXxx()
{
OnXxx(EventArgs.Empty);
}
protected override void OnXxx(EventArgs e)
{
Console.WriteLine("Raising from B");
DelegateXxx delegateXxx = Xxx;
if (delegateXxx != null)
delegateXxx(this, e);
}
}
public class C : A
{
public override event DelegateXxx Xxx;
public override void DoXxx()
{
OnXxx(EventArgs.Empty);
}
protected override void OnXxx(EventArgs e)
{
Console.WriteLine("Raising from C");
DelegateXxx delegateXxx = Xxx;
if (delegateXxx != null)
delegateXxx(this, e);
}
}
|
|
|
|
|
Thank you
|
|
|
|
|
Hello,
In a Application i used Microsoft.office reffernce. Then .Docx file Converts in .PNG.
But Now i have need without installed Microsoft Office Converts the File .DOCX to .PNG. I am using DocumentFormat.OpenXml.dll, but i am unable to convert .docx to .PNG.
So please Suggest me How i can convert .docx to .PNG without having Microsoft Office
Regards
Raushan Kumar
|
|
|
|
|
|
|
Hello Eddy Vluggen,
Thanks a lot for your good reply.
but by using this article we can just manipulate .docx file,
I have need to convert in Image File like(PNG\JPEG), still i have not get any idea for convert .docx to .PNG.
I have done by using the Microsoft word reference, but i need to run without Microsoft word installed.
Process which i have done:-
open document in word application then just split page wise in document after that copyaspicture.
I have called user32.dll native API for clipboard manipulation and then transfer file in MetaFile using intptr and then save the file in(PNG\JPEG)
So please give some idea how can i copy picture in clipboard ya any otherway without office reference.
Thanks
Raushan Kumar
|
|
|
|
|
raushan_9 wrote: So please give some idea how can i copy picture in clipboard ya any otherway without office reference.
Convert it to Html[^], and render the Html as a picture
I are Troll
|
|
|
|
|
How can I check if the value if null so that I do bnot get the error:
"object reference not set to an instance of an object" ?
This still gives the error:
if !((byte[])Message.GetField("FieldName", 0).Value == null
{
}
Thanks
|
|
|
|
|
Several variables could be null. By the way, what's the type of "Message"?
Try something like:
byte[] byteArray = null;
if (Message != null)
{
Field myField = Message.GetField("FieldName", 0);
if (Field != null)
{
object fieldValue = Field.Value;
if (fieldValue != null)
{
byteArray = (byte[])fieldValue;
}
}
}
|
|
|
|