VB -> C#: Lambda function should use dynamic type
Les mainteneurs répondent en général sous 1 jour
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 45/100
Piste de recherche
Commencez par la signature du callback Application.Eval et reproduisez l’entrée VB fournie dans la conversion VB-to-C#. Comparez le paramètre du callback généré et l’accès au membre Application.Session avec la sortie C# attendue. C’est terminé lorsque la conversion produit la forme C# prévue et qu’un cas de régression couvre cette entrée.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
I believe I have the correct C# code at the end, although I am not 100% certain.
In VB I was able to have the lambda function have a boolean, but in C# it appears it needs dynamic.
Also, note the different syntax for accessing members of Application.Session. In VB it is this
Public Shared ReadOnly Property Session As <Dynamic> Object
but in C# it is this.
public static dynamic Session { get; }`
VB.Net input code
Public Sub DetectIOSWebAppStandalone()
'does a one-time check of window.navigator.standalone and writes a session flag
'so we know if we have been launched in iOS webview
Application.Eval("window.navigator.standalone", Sub(a As Boolean)
If a = True Then
Application.Session("isIOSstandalone") = True 'its standalone mode
Else
Application.Session("isIOSstandalone") = False 'its not standalone mode
End If
End Sub)
End Sub
Erroneous output
public void DetectIOSWebAppStandalone()
{
// does a one-time check of window.navigator.standalone and writes a session flag
// so we know if we have been launched in iOS webview (or at least "Add To Homescreen App"
// need to combine this with hybrid flag... not sure if returns true in hybrid app!
Application.Eval("window.navigator.standalone", (bool a) => { if (a == true) { Application.Session("isIOSstandalone") = (object)true; } else { Application.Session("isIOSstandalone") = (object)false; } }); // its standalone mode
// its not standalone mode
}
Expected output
public void DetectIOSWebAppStandalone()
{
// does a one-time check of window.navigator.standalone and writes a session flag
// so we know if we have been launched in iOS webview (or at least "Add To Homescreen App"
// need to combine this with hybrid flag... not sure if returns true in hybrid app!
Application.Eval("window.navigator.standalone", (dynamic a) =>
{
if (a == true)
{
Application.Session.isIOSstandalone = true;
} else
{
Application.Session.isIOSstandalone = false;
}
});
//Application.Eval("window.navigator.standalone", (bool a) => { if (a == true) { Application.Session.isIOSstandalone = true; } else { Application.Session.isIOSstandalone = false; } }); // its standalone mode
// its not standalone mode
}
Details
CodeConverter 8.41
Signature of Application.Eval method in C#
//
// Summary:
// Executes the JavaScript script on the client and receives the return value (or
// null) in the callback method.
//
// Parameters:
// script:
// The script to evaluate.
//
// callback:
// Asynchronous callback method that receives the return value.
public static void Eval(string script, Action<dynamic> callback);
Signature of Application.Eval method in VB
'
' Summary:
' Executes the JavaScript script on the client and receives the return value (or
' null) in the callback method.
'
' Parameters:
' script:
' The script to evaluate.
'
' callback:
' Asynchronous callback method that receives the return value.
Public Shared Sub Eval(script As String, <Dynamic({False, True})> callback As System.Action(Of Object))`
- Langage dominant
- C#
- Étoiles
- 918
- Forks
- 244
- Merge moyen
- 1 j 10 h
- PR mergées (30 j)
- 29
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de icsharpcode/CodeConverter
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
icsharpcode/CodeConverter#1271 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
enhancement
Difficulté 4/5 3-5 jours Accessibilité débutants 52/100
icsharpcode/CodeConverter#1243 · 2 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
VB -> C#: Enum Values as IntegerPeut-être à nouveau libre Une pull request pour cette issue a été fermée sans être fusionnée. OuverteGood for coding agent VB -> C#
Difficulté 3/5 1-2 jours Accessibilité débutants 45/100
icsharpcode/CodeConverter#1212 · 2 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
Good for coding agent VB -> C#
Difficulté 3/5 1-2 jours Accessibilité débutants 48/100
icsharpcode/CodeConverter#1211 ·
Les mainteneurs répondent en général sous 1 jour
-
C# -> VB
Difficulté 4/5 3-5 jours Accessibilité débutants 30/100
icsharpcode/CodeConverter#1171 · 7 commentaires ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de icsharpcode/CodeConverter
Issues similaires
-
hand-to-AI
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
CactuseSecurity/firewall-orchestrator#5803 ·
Les mainteneurs répondent en général sous 1 jour
-
Typed MINID rejects numeric thresholds with a leading plus sign accepted by Redis and ValkeyOuvertebug
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
Les mainteneurs répondent en général sous 1 jour
-
DXF with empty names failsOuvertebug
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
Les mainteneurs répondent en général sous 3 jours
-
bug python
Difficulté 1/5 Moins d'une heure Accessibilité débutants 88/100
ilia-sokolov/OfficeAgent.NET#89 ·
Les mainteneurs répondent en général sous 13 jours