TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Ram Prasad
NA
326
18.5k
using array from custom class and them compare it with other
Sep 25 2019 9:03 PM
I would like to use NWCdecimal[] in Main while comparing it with decimal[] to get the output. However, I am not able to compare the two and getting error "Operator '==' cannot be applied to operands of type 'NWC' and 'int'" How this can be achieved? Also, NECdecimal[] cannot be moved out of NWC class. (This is an incomplete code, just looking to be pointed in right direction)
public
class
NWC
{
public
int
Number {
get
;
set
; }
public
int
[] NWCdecimal =
new
int
[20]
{ 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
}
public
static
int
[] deci =
new
int
[5]{0,1,4,5,10 };
in main when I compare
for
(
int
i = 0; i < NWCdecimal.Length; i++)
{
for
(
int
j = 0; j < deci.Length; j++)
{
if
(NWCdecimal[i] == deci[j])
{
Console.WriteLine(NWCdecimal[i]);
}
else
{
Console.WriteLine(E);
}
}
this gives me error Operator '==' cannot be applied to operands of type 'NWC' and 'int'
Reply
Answers (
2
)
how to achieve role based login with mvc entity code first a
how can i put the ConnectionString of db to all project c#