|
What attribute can I add to the field.
Also how do i get this attribute in MemberInfo class
|
|
|
|
|
You can make your own attribute up. Also, you wouldn't use MemberInfo ; you stated you wanted this for fields, so you would use FieldInfo . FieldInfo exposes an Attributes property that you can iterate through to get your custom attribute.
|
|
|
|
|
There's a few obvious options that come to mind here:
- First, can you just declare them in the order you want them? GetMembers seems to reliably return the same order, which is declaration order within one type of member (i.e. fields). I'm not sure the Framework guarantees that, though.
- Add an attribute with a numeric order value, and sort the final list based on that.
- Have an external list of the names you want in the right order, and iterate through that instead of GetMembers. This has the disadvantage that if you add a field you must remember to add it to this list too.
|
|
|
|
|
I think the key question here is what determines the 'particular order' you want the Members in: which ones do you want to ignore ? To use your Class A example: do you want only the members (Fields) that are defined internally as variables, or are you going to want to distinguish between methods you've defined in the class and the "other stuff" every class gets by default like:
System.String ToString()
Boolean Equals(System.Object)
Int32 GetHashCode()
System.Type GetType()
Void .ctor()
If you are after recognizing 'Fields' only, then MemberType will identify your added Fields for you.
best, Bill
"I have always wished for my computer to be as easy to use as my telephone; my wish has come true because I can no longer figure out how to use my telephone." Bjarne Stroustrop circa 1990
|
|
|
|
|
Why are you trying to do this? It's a little unusual, perhaps there might be an alternative approach to trying to solve your problem.
Regards,
Rob Philpott.
|
|
|
|
|
can somebody tell me , guide me
about developing web based helpdesk application?
I need to develop such kind of application.
I need to learn & develop myself for web based helpdesk application.
If somebody has samples & tutorials or any other documentation,
please share me anytime.
|
|
|
|
|
It depends on your level of knowledge of web programming. You could start at the Microsoft ASP.NET[^] website for tutorials and samples, and also use the CodeProject ASP.NET[^] forum for further questions.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
thank for reply,
I mean, I need to read e-book or quickstart documentation for creating web based helpdesk application in .Net.
if anyone has already simple sample for web based helpdesk application, I want to learn, follow steps and develop new one.
I want to use it (sample) as a reference.
I need to learn about it.
pls share me the link, or tutorials or ebooks about creating web based helpdesk app:
|
|
|
|
|
You're approaching this the wrong way. Rather than asking for somebody to give you source code, you should be gathering your requirements. So far, all you seem to know is that it's for a help desk and it's to be accessed via HTTP. Are you going to be using a browser? If so, are you only targetting one or is it cross browser? What about mobile versions? What features do you expect your help desk to have? How will you be securing it? Will people log in via Active Directory, OpenID or forms based authentication?
This MUST be your first step. If you try to develop software without knowing what the requirements are, you will fail to deliver a solution that your clients want.
|
|
|
|
|
ok
web based helpdesk application that I want to develop is like this online demo
here is link:
http://demo.servicedeskplus.com/WOListView.do?requestViewChanged=true&
as this deom...
regarding to customer side requests for problems,
the application keep customer information, such as name, contact no., problem description, date...sth like that.
the application also show open ticket, close ticket.
open ticket mean that there is a case need to be resolved.
closed ticket mean is the completed task resolved by technician.
|
|
|
|
|
And do you think that's anywhere near enough requirements gathering?
If you are serious about being a professional programmer, you must learn how to be able to push for detailed requirements. Once you have requirements, pull together some use cases to show how the requirements will be met; include negative cases as well as positive cases, so your code can cope with failures in business process (for instance, consider what would happen if a technician didn't pick up a ticket; what escalation procedures would you need to put in place).
Once you have the requirements and cases to follow, actually coding the application is relatively trivial.
|
|
|
|
|
sankooo wrote: is like this online demo servicedeskplus[^]
It would probably be much faster and easier for you to use one of the versions offered by this company.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
I am planning to create a Licensing Module which can be commonly used for all Desktop Applications. So i thought of making it so simple without any or less coding in the existing applications which are going to be activated by this Licensing Module.
So is there any way where if the user passes the exe location, the system should capture the exe available in the particular location, and the system should get all the windows forms available inside that exe?
Am not sure whether it is possible or not but i need to know whether there is any way to do it. It would be helpful for me to develop this with less complications.
|
|
|
|
|
Yes, that can be easily done.
First, load the assembly with Assembly.Load
Then, call GetTypes on the assembly that you just loaded,
Then, for each type in the Type array, check if it "is" a "Form" like so:
foreach ( Type T in typeArray)
if (T is Form)
Do stuff....
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Assuming the exe is a dotnet assembly, that is not implied by the question!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Boy, you're all over me today. In the lounge and here.
The fact that it's a dot net assembly is implied by two very strong factors:
1. The fact that this is the C# forum
2. The fact that he referred to the type "Form" which is a dot net type.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Richard Andrew x64 wrote: you're all over me today
Ah I missed the assembly point, being in the c# forum I don't feel would have been conclusive!
Its not personal, I grump at everyone.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Mycroft Holmes wrote: Its not personal, I grump at everyone.
No worries!
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
thanks a lot buddy....it worked perfectly...i created the following method according to your idea...
Assembly SampleAssembly = Assembly.LoadFrom("Assembly Path Here");
// Display all the types contained in the specified assembly.
foreach (Type oType in SampleAssembly.GetTypes())
{
Console.WriteLine(oType.Name);
}
you saved ma day....thanks again buddy...
|
|
|
|
|
I'm inexperienced when it comes to creating my own interfaces in C#.
Why would one choose to A) implement or B) explicitly implement an interface?
I have read that an explicit implementation can only be called through an instance of the interface.
Why would this be desirable or not desirable?
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Conflicting interfaces!
Suppose you have
public interface ISimpleCalculator
{
int Calculate(int num1, int num2);
}
public interface IFancyCalculator
{
CalculationResult Calculate(int num1, int num2);
}
Now, suppose I want to implement both these interfaces in a VersatileCalculator class. I can't implement both Calculate methods, though, because methods can't be overloaded on different return types alone - their names and parameter lists are identical!
So the way I'd handle this is to explicitly implement the interfaces, and then have a regular Calculate method which just calls one of the implementations or has an extra parameter to choose an implementation or something.
|
|
|
|
|
Oh, I see. So it makes sense to default to explicit implementation then, right?
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
I usually default to implicit and only use explicit when I have to; the syntax is a bit weird, and since explicit implementation requires casting to the interface type to call the method, it could be confusing to a consumer of your code.
|
|
|
|
|
One case would be if you have implemented multiple interfaces that have methods with same signature. The only way to differentiate to explicitly implement the method
No comment
|
|
|
|
|
So would you say that explicit implementation is something you do only when needed, or is it the usual?
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|