Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Implementing IDisposable in a class
Message
De
14/02/2014 03:47:52
 
 
À
13/02/2014 15:30:02
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01594093
Message ID:
01594290
Vues:
43
>>Compiles and runs for me. What did the IDE say ?
>
>The following code:
>
>
>' Create the operation context scope needed to add headers
>Using loSOAPSVC.oOperationContextScope = New System.ServiceModel.OperationContextScope(loMyService.InnerChannel)
>
>End Using
>
>
>...would cause the designer to report this:
>
>"Operator '=' is not defined for types 'System.ServiceModel.OperationContextScope' and 'System.ServiceModel.OperationContextScope'."

Interesting. It does work in C# - I just ran my code thru a converter. TBH I don't think it should work in C# either - the docs for 'using' state:
"Within the using block, the object is read-only and cannot be modified or reassigned." But this is allowed:
using (mySvc.Something = new OperationContext())
                {
                    mySvc.Something = new OperationContext();
                };
whereas the following gives the expected error 'Readonly local variable cannot be used in any execution path':
using (var test = new OperationContext())
                {
                    test = new OperationContext();
                };
Seems to me C# is letting an invalid construct slip past?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform