|
No, on the contrary, at least if we are talking about System.Drawing.Bitmap. This one implements IDisposable and allows you to explicitely release the resources and to notify the GC that there is no need to finalize this object.
It depends a lot on the scenario in which you are using it:
If you create a Bitmap and use it in a local scope, use the using syntax:
using (Bitmap tB = new Bitmap(...)) {
}
If you need to keep references to Bitmap object (as you apparently do), then take care that after calling Bitmap.Dispose no reference to that object exists in your program. Assuming your Bitmap container is a Queue<Bitmap> :
using (Bitmap tB = BitmapQueue.Dequeue());
|
|
|
|
|
How can I check file is broken?
I want to get alarm when text file or .sdf (database file) file is broken in specified directory.
How can I check it in C#?
Thanks...
|
|
|
|
|
What do you mean by broken?
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
nils illegitimus carborundum
me, me, me
|
|
|
|
|
|
You'd need to have something to compare it to; the original, undamaged file then carry out a byte-by-byte comparison. You could create a checksum of the original file and store that then compare that to the checksum of the damaged file. You could also compare file lengths; if they are different then so are the files (obviously). If you don't have the original file to compare to then you might be a bit stuck unless the damage you are looking for is quite specific and testable.
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
nils illegitimus carborundum
me, me, me
|
|
|
|
|
digital man wrote: If you don't have the original file to compare to then you might be a bit stuck unless the damage you are looking for is quite specific and testable.
That's testing whether the .sdf has changed, compared to the original. It's probably a SqlCE database, and it's checksum would change on every update/delete.
I are Troll
|
|
|
|
|
dataminers wrote: How can I check file is broken?
Define "broken"; a textfile may contain any character, printable or not. Does the textfile have a specific format that you can compare against?
The SqlCe database is somewhat easier to verify, and that's documented over here[^]
I are Troll
|
|
|
|
|
I have print statement in Sql Sp. How can I bind print statement to DropdownList
|
|
|
|
|
hi friends & all seniors,
i have created a user control. i want to add it dynamically to list view. for certain criteria i am saying
for(certain condition)
listview.control.add(object_of_createdUserControl);
If i am using this for flow layout panel it works fine. but this fails for list view.
i dont get any error and all the objects of user control are added to the listview but only the first is displayed.
hope i have stated my problem correctly
Looking forward for your kind response!!
Regards
Samir
|
|
|
|
|
Did you check the Location property of your newly added user controls? Perhaps they are all at the same place, and hence only one of them appears on the screen.
|
|
|
|
|
In general if you want to add multiple controls to a Listview then you need to produce a custom list view control derived from ListView.
Check out this link C# Listview 1.3
|
|
|
|
|
How can I binding of DomainUpDown control to some variable that i hold.
modified on Thursday, August 19, 2010 12:42 AM
|
|
|
|
|
hi
please... i try..... but i dont know java-script......
if someone can help me... i'll be grateful
this:
http://static.peace-love-freedom.net/js-itm/trunk/jsdoc/symbols/src/js-itm.js.html
thank's in advance
|
|
|
|
|
Then start learning.
This code is simply creating a class with some methods, i.e. functions
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
See, Javascript is a client end language that runs in the browser, while C# is the code that runs in the server. Just put all the data you need in JSON format and send it using AJAX to a handler. You can also use hiddenfield or XML or by any means. Now from Server use the handler to parse JSON object and get the data.
Read about AJAX and also start learning the basics of C#.
Abhishek Sur
Don't forget to click "Good Answer" if you like this Solution. Visit My Website-->www.abhisheksur.com
|
|
|
|
|
Google and do some hands-on JavaScript
// ♫ 99 little bugs in the code,
// 99 bugs in the code
// We fix a bug, compile it again
// 101 little bugs in the code ♫
|
|
|
|
|
|
Is it possible to dynamically adding custom attributes to class methods or properties? If so any examples will be appreciated.
|
|
|
|
|
No
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Man, way to crush his dreams
|
|
|
|
|
Try This [^]
I know nothing , I know nothing ...
|
|
|
|
|
This is using codedom to write code dynamically not dynamically adding an attribute to existing code. They are not equal.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Would compiling code at runtime suffice (e.g., creating a new class with methods/properties that have the custom attributes)? That can be done.
|
|
|
|
|
don't kill the pianist, but I thing I did somethings related to this. It was some time ago and I don't have that resources, but here is the catch.
There was a way to specify what property "descriptor" to use for a specific class. From that class, you call the default property descriptor and modify the returned list of attributes as you wish. Sorry if the terms are not quite accurate but they may bring up someone [else?] idea about how to do this.
|
|
|
|
|
If it's possible to dynamically add custom attributes to a class, you'll be jumping through so many hoops to do so that perhaps a better question to ask is: "am I trying to do something I shouldn't be trying to do?"
Also, by attempting to do something so far "outside the box" of .Net programming as it was intended by MS that you'll potentially be creating a maintenance problem for whoever works on the code after you.
If you need to dynamically decorate a type, property, etc. with attribute-like information, perhaps a wiser design is to implement your own repository of such information (perhaps a static Dictionary<MemberInfo, MyCustomAttribute> , or some such). If necessary, you can initialize it from the complier-built attributes, but that should be the end of your logic's relationship with attributes.
Just a thought.
|
|
|
|
|
My class exposes some controls via properties. I need to invoke certain properties of these controls that are decorated with my custom attributes. So let’s take example. Here is how my class look like
public partial class Form1 : Form
{
public Control Button1
{
get { return this.btn1; }
}
[MyCustomAttributes]
public Control Button2
{
get { return this.btn2; }
}
}
Now I want to dyanmically call Visible property to false on the Control properties that are decorated with MyCustomAttributes attribute.
PropertyInfo[] PI = typeof(Form1).GetProperties();
foreach (PropertyInfo property in PI)
{
MyCustomAttributes myAtt = (MyCustomAttributes)Attribute.GetCustomAttribute(property, typeof(MyCustomAttributes));
if (myAtt == null) continue;
property.SetValue("Visible", false, null); }
But I get exception that "Property set method not found". Any ideas what I am doing wrong here?
|
|
|
|