public static List<List<T>> Split<T>(List<T> source) { return source .Select((x, i) => new { Index = i, Value = x }) .GroupBy(x => x.Index / 4) .Select(x => x.Select(v => v.Value).ToList()) .ToList(); }
Hi All In this blog you will get to know some of the problems i have faced during my day to day work. and the solutiosn that i have used for those problems.
Monday, March 18, 2013
c# split list into sub lists
Read file content with File reader
using (StreamReader stream = File.OpenText(PathOfFile)) { string fileContentsDatas = stream.ReadToEnd();
}
Friday, February 1, 2013
Fluient nhibernet syntaxes
After a long time working on nhibernet fluient
I like that much with c# syntax
It is really good rather than the normal syntax with xmles
I like that much with c# syntax
It is really good rather than the normal syntax with xmles
Handlin radio button with value javascript
<script type="text/javascript">
function Str() {
var theSelectedRadio = document.getElementsByName("x");
for (var i = 0; i < theSelectedRadio.length; i++) {
if (theSelectedRadio[i].checked) {
alert(theSelectedRadio[i].value);
}
}
}
</script>
<body>
</body>
<input id="x" type="radio" name="x" value="true" />
<input id="y" type="radio" name="x" value="false" />
<input id="z" type="radio" name="x" value="NotSelected" />
<input type="radio" name="x" value="NotSelectedThere" />
<input type="button" value="s" onclick="Str()" />
function Str() {
var theSelectedRadio = document.getElementsByName("x");
for (var i = 0; i < theSelectedRadio.length; i++) {
if (theSelectedRadio[i].checked) {
alert(theSelectedRadio[i].value);
}
}
}
</script>
<body>
</body>
<input id="x" type="radio" name="x" value="true" />
<input id="y" type="radio" name="x" value="false" />
<input id="z" type="radio" name="x" value="NotSelected" />
<input type="radio" name="x" value="NotSelectedThere" />
<input type="button" value="s" onclick="Str()" />
Subscribe to:
Posts (Atom)