Hello everyone! I would like to know how I can read metadata of exported types using the Managed Extensibility Framework. I am using Visual Studio 2008 with .Net Framework 3.5.
In .Net Framework 4.0, this can be achieved through type 'Lazy' but this is not available in .Net Framework 3.5.
Since 'ExportMetadata' was provided in the version of MEF provided for .Net Framework 3.5, I do believe there is a way of reading the metadata in the framework 3.5 but I don't know how this is done. Any guidance, please?
When you add a reference over the network, the IDE will make a local copy of this dll anyway.
So, nothing should be stopping you from copying the dll to your own machine / project folder and referencing it from this local location.
i use c# with asp.net ,i didn't understand how to add zoom bar to my google map.
in the aspx file the map configure like this:
<cc1:GMap ID="GMap3" runat="server" Width="850px" Height="500px" Language="he"
and the key is configure in the cs file.i saw lots of exsample but evrything in aspx file ,and if i try to change there something i have error in the visual studio.
so i hust want to know how to add this zoom bar in the left
Have a self-hosted WCF REST service w/ custom authentication (UsernamePasswordValidator). I need to return business specific errors from the validator. All methods I have tried to do this with have failed because all the errors get hidden by the HttpWebRequest object in a generic "Forbidden." error. My latest attempt was to write an error code back. Normally, I would do this by using the OperationContext.Current to get the response stream, but OperationContext.Current = null. How does one initialize this in a self-hosted service?
I have a form with a progressBar on it. I'm doing writes in another class (through my interface) and need to show my progress of doing the writes, but I'm getting an error message *. Hopefully someone has an idea how to get the error to go away and so I can update my progressBar from a different class.
I'm more of a C++ developer doing C#, so there might be something that an experienced C# person would know of that I'm missing.
It looks like this:
Form with progressBar displayed
privateint writeIt(refbyte wDat, byte sDat)
result = cr.ProcessTWriting(ref wDat, ref pb_Progress.Value); //this passes a ref to the progressBar value
* In the code above, I'm getting "A property, indexer or dynamic member access may not be passed as an out or ref parameter" error message.
My interface looks like this:
iCR.cs (which is in another VS project due to future CR6, etc. which will use the interface)
int ProcessTWriting(refbyte wDat, refint pb_value);
Then, I want to pass my references (to progressBar value) to where I'm writing my bytes (i to 1024), and update the reference to the progressBar as it iterates through, writing to it's destination.
This would be in my CR5.cs which implements iCR.cs (and is in another VS project still...think Factory pattern):
Sorry in advance for my english. Possibly is not good enough yet...
Do you have the possibility to change your interface?
I'm thinking that a solution to your problem could be the use of events on your CR5 class. (Observer pattern)
You could create an event on CR5 class that can be subscribed by the class that contains the progress bar. Then, you can fire your event on the AttempWrite function with a parameter that indicates de current progress value to set into the progress bar.
Is it a possibility? Or are you constrained to this interface contract?
That's a good idea. I'll give that a try. I can absolutely change my interface. That's why I'm showing the progressBar value in the interface now. I'm not absolutely sure how to send a value when I fire an event, but I'll take a look. Thanks!
inside one of the Framework class. likewise we can also define our own delegates that suits to our need. here instead of using the native handler I defined a custom delegate to fire an event. Read the following articles which explains more about events and delegates. Events-and-Delegates-Simplified and Step-by-Step-Event-handling-in-C#
class MyCR: CRInterface
publicevent ProgressChangeHandler ProgressChanged;
publicint ProcessTWriting(refbyte WDat, refint pb_value)
status = AttemptWrites(ref pb_value);
privateint AttemptWrites(refint pb_value)
for (int i = 0; i < ((wDat.Length) / 4); i++)
//as it does writes, I want to set pb_value here to % complete
privatevoid RaiseProgressChange(int progress)
Finally Subscribe for event change in your FormClass i.e PC.cs
// call this line just below where you create the instance of CR5 class
cr.ProgressChanged += new ProgressChangeHandler(CR_ProgressChanged);
privatevoid CR_ProgressChanged(int progress)
progressBar.Value = progress;
The above code sample is working version if you closely look at the sample you can find that delegate method is defined in the dll where iCR is located and you don't need to use the Public access specifier for Interface methods and data.
This will definitely work and I have done same stuff in the past.
ProgressChangeHandler must be defined globally so that this delegate is accessible by all members.