How to create wrapper holding of multiple properties in c# -
i want wrapper whether class or list type, hold multiple properties. want store values of properties , retrieve later. created class , doing operations below.
internal class dependencies { public string issueid; public int dependencycheck; public string jirastatus; public dependencies() { this.issueid = string.empty; this.dependencycheck = 0; this.jirastatus = string.empty; } //calling function. preapreissueslist(issuekey, jiratoken); private static void preapreissueslist(string issuekey,string jiratoken) { dependencies dependeant = new dependencies(); if (!dependeant.issueid.contains(issuekey)) { dependeant.issueid = issuekey; jirasoapserviceservice jira = new jirasoapserviceservice(); remoteissue ri = jira.getissue(jiratoken, (issuekey).tostring()); dependeant.jirastatus = enum.getname(typeof(getchangesets.jiraoperations.jirastatus), convert.toint32(ri.status)); dependeant.dependencycheck = 0; } else if (dependeant.issueid.contains(issuekey)) { dependeant.dependencycheck = 1; } }
if this, hold stored values? or better take dependencies
of list<>
type? can 1 suggest me answer?
from can see, not store information dependencies
objects. after created in prepareissueslist
, go out of scope , garbage collecter dispose of them.
you need keep reference them somewhere keep information. maybe prepareissueslist
should return dependencies
object creates, , whatever calling method can store object?
as aside, code above not compile - call prepareissueslist
made within class body, , compiler thinks method declaration. also, class called dependencies
seems describe single item, maybe dependency
better name?
Comments
Post a Comment