VB -> C#: Lambda function should use dynamic type
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 45/100
Hướng nghiên cứu
Bắt đầu với chữ ký callback của Application.Eval và tái tạo đầu vào VB được cung cấp trong quá trình chuyển đổi VB-to-C#. So sánh tham số callback được tạo ra và quyền truy cập thành viên Application.Session với đầu ra C# mong đợi. Được coi là hoàn tất khi quá trình chuyển đổi tạo ra dạng C# dự kiến và một trường hợp hồi quy bao quát đầu vào này.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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))`
- Ngôn ngữ chính
- C#
- Star
- 918
- Fork
- 244
- Merge trung bình
- 1 ngày 10 giờ
- Pull request đã merge (30 ngày)
- 29
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của icsharpcode/CodeConverter
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
icsharpcode/CodeConverter#1271 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 52/100
icsharpcode/CodeConverter#1243 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
VB -> C#: Enum Values as IntegerCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mởGood for coding agent VB -> C#
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
icsharpcode/CodeConverter#1212 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Good for coding agent VB -> C#
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 48/100
icsharpcode/CodeConverter#1211 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
C# -> VB
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 30/100
icsharpcode/CodeConverter#1171 · 7 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của icsharpcode/CodeConverter
Issue tương tự
-
DXF with empty names failsĐang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 3 ngày
-
bug python
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
ilia-sokolov/OfficeAgent.NET#89 ·
Maintainer thường phản hồi trong vòng 13 ngày
-
documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
juandresrodca/AdminForge#66 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
umbraco/Umbraco.Automate#612 ·
Maintainer thường phản hồi trong vòng 1 ngày