Developers can add metadata to their code through attributes. There are two types of attributes, custom and pseudo custom attributes, and to the developer these have the same syntax. Attributes in code are messages to the compiler to generate metadata. In CIL, metadata such as inheritance modifiers, scope modifiers, and almost anything that isn't either opcodes or streams, are also referred to as attributes.<br />
A custom attribute is a regular class that inherits from the Attribute class. <br />
Custom attributes are used by the .NET Framework extensively. Windows Communication Framework uses attributes to define service contracts, ASP.NET uses these to expose methods as web services, LINQ to SQL uses them to define the mapping of classes to the underlying relational schema, Visual Studio uses them to group together properties of an object, the class developer indicates the category for the object's class by applying the [Category] custom attribute. Custom attributes are interpreted by application code and not the CLR.When the compiler sees a custom attribute it will generate custom metadata that is not recognised by the CLR. The developer has to provide code to read the metadata and act on it.
First of all, there is no implicit loop operation that breaks out at a specified time interval. You'll have to code it yourself.
Secondly, as your loop depends on reaching a value or a timeout being reached, a for loop is not the appropriate choice - it is designed to work with a fixed number of iterations. In this case, I would choose to use a while loop instead. Then you could do something like the following:
Stopwatch watch = new Stopwatch();
int count = 0;
} while (++count < 10 && watch.Elapsed <= TimeSpan.FromSeconds(2) );
In my application i have an XML like this..
I want to perform a search in this XML Based on SubID, ModuleId, TaskName, between start and end dates. Please help me. Also i need all the parents of the searched nodes without siblings.
As they are attributes, you need to use attribute based searches in your XPath. The type of syntax you are looking to use is //[@...=value].
You are going to have a problem with the date part as this stands because your data is all text as far as the parser is concerned. In order to work with date information, you are going to have to provide a schema and set the data types as appropriate.
BTW, your XML is malformed - you must enclose your values in quotes, so having TaskId=9 is incorrect and it should actually be TaskId="9"
I already told you that your date search wouldn't work because the data type is a string, and you need to create a schema for this. If you had read my answer fully, you'd have seen that vital piece of information.
I wonder if there is a services-like platform in C# where I can build addons onto. And when I say services, I mean the kind of services Windows has, which I can inject dependencies, trigger a start\stop and add\remove addons as I wish.
I will also need a way of controling it, like a console, MMC or some other kind of UI.
Does anyone know of something similar to what I'm looking for? it'll really help me out