Community does not provide any code conversion services. You should tell us what class or method you want to implement? What have you tried yourself? And what is the problem that confuses you?
Based on the code provided, it seems that you want to declare a class with multiple fields and initialize it or set its properties.
About how to declare class, you can refer to this documentation:
Classes.
class CalssDemo
{
int userId;
int gameId;
Array[] resultNum1;
// other fields...
}
To set/modify a field, you can define the
method in class.
// other fields...
public void setGameId(string gId)
{
gameId = gId;
}
To “init” the class, you can refer to this documentation to define
Constructors.
None
0 Points
4 Posts
java to c# ??
Jan 21, 2021 08:26 AM|tgxman|LINK
Hello is there any way someone can help me out with converting below Java to C#.
Participant
1620 Points
927 Posts
Re: java to c# ??
Jan 22, 2021 01:10 AM|PaulTheSmith|LINK
What is the problem?
On the first line you don't need the keyword 'function' and the method will need a return type. Are there other problems?
What have you done so far? What do you have a difficulty with?
None
0 Points
4 Posts
Re: java to c# ??
Jan 22, 2021 02:31 AM|tgxman|LINK
I want to change the java code to C# code Working without problems
Member
80 Points
23 Posts
Re: java to c# ??
Jan 22, 2021 06:05 AM|kyle0418|LINK
First, isn't this JavaScript?
Community does not provide any code conversion services. You should tell us what class or method you want to implement? What have you tried yourself? And what is the problem that confuses you?
Based on the code provided, it seems that you want to declare a class with multiple fields and initialize it or set its properties.
About how to declare class, you can refer to this documentation: Classes.
To set/modify a field, you can define the method in class.
To “init” the class, you can refer to this documentation to define Constructors.
Or to invoke js function, you can try to use Blazor. Here is the tutorial: Call JavaScript functions from .NET methods in ASP.NET Core Blazor.
None
0 Points
4 Posts
Re: java to c# ??
Jan 22, 2021 06:39 AM|tgxman|LINK
Is it the right way? It would be appreciated if someone could edit the full code. (__)
Member
80 Points
23 Posts
Re: java to c# ??
Jan 22, 2021 06:52 AM|kyle0418|LINK
C# also has for statement.
None
0 Points
4 Posts
Re: java to c# ??
Jan 22, 2021 07:13 AM|tgxman|LINK
numFunc:function(A){ var g,I=0, B=new Array, t=(new Array,new Array); g=A.length; for(var e=0;e<g;e++) A.charCodeAt(e)>=48&&A.charCodeAt(e)<=57&&A.charAt(e)!=A.charAt(e-1)&&(B[I]=A.charAt(e),I++); for(e=0;e<B.length;e++) for(var s=0;s<B.length;s++)e!=s&&B[e]==B[s]&&B.splice(s<e?e:s,1); if((t=B.splice(0,4)).length<4){ for(var i=t.length;i<4;i++)t.push("0"); return t } return t }
How do I change the code above?